27 lines
686 B
Text
27 lines
686 B
Text
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
|