Sequence of non-squares: Difference between revisions

Sequence of non-squares en Yabasic
(Sequence of non-squares en True BASIC)
(Sequence of non-squares en Yabasic)
Line 3,004:
2 3 5 6 7 8 10 11 12 13 14 15 17 18 19 20 21 22 23 24 26 27
</pre>
 
 
=={{header|Yabasic}}==
<lang yabasic>// Display first 22 values
print "The first 22 numbers generated by the sequence are : "
for i = 1 to 22
print nonSquare(i), " ";
next i
print
 
// Check for squares up to one million
found = false
for i = 1 to 1e6
j = sqrt(nonSquare(i))
if j = int(j) then
found = true
print i, " square numbers found" //print "Found square: ", i
break
end if
next i
if not found print "No squares found"
end
 
sub nonSquare (n)
return n + int(0.5 + sqrt(n))
end sub</lang>
 
 
=={{header|zkl}}==
2,148

edits