Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Square-but-not-cube/CLU/square-but-not-cube.clu
Normal file
27
Task/Square-but-not-cube/CLU/square-but-not-cube.clu
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue