Sequence of non-squares: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added whitespace.) |
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
||
Line 125: | Line 125: | ||
Loop 1000000 |
Loop 1000000 |
||
x := A_Index + floor(0.5 + sqrt(A_Index)), s += x = round(sqrt(x))**2 |
x := A_Index + floor(0.5 + sqrt(A_Index)), s += x = round(sqrt(x))**2 |
||
Msgbox Number of bad squares = %s% ; 0</lang> |
Msgbox Number of bad squares = %s% ; 0</lang> |
||
=={{header|AWK}}== |
=={{header|AWK}}== |
||
Line 1,280: | Line 1,280: | ||
</pre> |
</pre> |
||
=={{header|Mathematica}}== |
=={{header|Mathematica}}== |
||
<lang Mathematica>nonsq = (# + Floor[0.5 + Sqrt[#]]) &; |
<lang Mathematica>nonsq = (# + Floor[0.5 + Sqrt[#]]) &; |
||
Line 1,656: | Line 1,657: | ||
{{out}} |
{{out}} |
||
<pre>2 3 5 6 7 8 10 11 12 13 14 15 17 18 19 20 21 22 23 24 26 27</pre> |
<pre>2 3 5 6 7 8 10 11 12 13 14 15 17 18 19 20 21 22 23 24 26 27</pre> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
Line 2,081: | Line 2,066: | ||
#f |
#f |
||
</pre> |
</pre> |
||
⚫ | |||
(formerly Perl 6) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
Line 2,420: | Line 2,422: | ||
no squares found |
no squares found |
||
</pre> |
</pre> |
||
=={{header|VBA}}== |
=={{header|VBA}}== |
||
<lang vb> |
<lang vb> |
||
Line 2,444: | Line 2,447: | ||
<pre>values for n in the range 1 to 22 : 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, |
<pre>values for n in the range 1 to 22 : 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, |
||
0 squares less than 1000000</pre> |
0 squares less than 1000000</pre> |
||
=={{header|XLISP}}== |
=={{header|XLISP}}== |
||
<lang lisp>(defun non-square (n) |
<lang lisp>(defun non-square (n) |