Square but not cube: Difference between revisions

Content added Content deleted
(Add PILOT)
(Add CLU)
Line 649: Line 649:
Both squares and cubes:
Both squares and cubes:
(1 64 729 4096 15625 46656 117649 262144 531441 1000000 1771561 2985984 4826809 7529536 11390625)</pre>
(1 64 729 4096 15625 46656 117649 262144 531441 1000000 1771561 2985984 4826809 7529536 11390625)</pre>

=={{header|CLU}}==
<lang clu>square_not_cube = iter () yields (int)
cube_root: int := 1
square_root: int := 1
while true do
while cube_root ** 3 < square_root ** 2 do
cube_root := cube_root + 1
end
if square_root ** 2 ~= cube_root ** 3 then
yield(square_root ** 2)
end
square_root := square_root + 1
end
end square_not_cube

start_up = proc ()
amount = 30
po: stream := stream$primary_output()
n: int := 0
for i: int in square_not_cube() do
stream$putright(po, int$unparse(i), 5)
n := n + 1
if n // 10 = 0 then stream$putl(po, "") end
if n = amount then break end
end
end start_up</lang>
{{out}}
<pre> 4 9 16 25 36 49 81 100 121 144
169 196 225 256 289 324 361 400 441 484
529 576 625 676 784 841 900 961 1024 1089</pre>


=={{header|COBOL}}==
=={{header|COBOL}}==