Sequence of non-squares: Difference between revisions

no edit summary
m (→‎{{header|REXX}}: changed some variable names and indentations, used a template for the output section, optimized a DO loop.)
No edit summary
Line 2,215:
no squares found
</pre>
=={{header|VBA}}==
<lang vb>
Sub Main()
Dim i&, c&, j#, s$
Const N& = 1000000
s = "values for n in the range 1 to 22 : "
For i = 1 To 22
s = s & ns(i) & ", "
Next
For i = 1 To N
j = Sqr(ns(i))
If j = CInt(j) Then c = c + 1
Next
Debug.Print s
Debug.Print c & " squares less than " & N
End Sub
 
Private Function ns(l As Long) As Long
ns = l + Int(1 / 2 + Sqr(l))
End Function</lang>
{{out}}
<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>
=={{header|XLISP}}==
<lang lisp>(defun non-square (n)
Anonymous user