Sequence of non-squares: Difference between revisions

Added Arturo implementation
(Replaced "round.int" by "toInt". Simplified "issqr". Replaced "proc" by "func". Improved output.)
(Added Arturo implementation)
Line 139:
HOWMANYSQUARES NONSQUARE 1000000
0</lang>
 
=={{header|Arturo}}==
 
<lang rebol>f: function [n]->
n + floor 0.5 + sqrt n
 
loop 1..22 'i ->
print [i "->" f i]
 
i: new 1, nonSquares: new []
while [i<1000000][ 'nonSquares ++ f i, inc 'i]
squares: map 1..1001 'x -> x ^ 2
 
if? empty? intersection squares nonSquares -> print "Didn't find any squares!"
else -> print "Ooops! Something went wrong!"</lang>
 
{{out}}
 
<pre>1 -> 2
2 -> 3
3 -> 5
4 -> 6
5 -> 7
6 -> 8
7 -> 10
8 -> 11
9 -> 12
10 -> 13
11 -> 14
12 -> 15
13 -> 17
14 -> 18
15 -> 19
16 -> 20
17 -> 21
18 -> 22
19 -> 23
20 -> 24
21 -> 26
22 -> 27
Didn't find any squares!</pre>
 
=={{header|AutoHotkey}}==
1,532

edits