Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
25
Task/Generator-Exponential/Icon/generator-exponential.icon
Normal file
25
Task/Generator-Exponential/Icon/generator-exponential.icon
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
procedure main()
|
||||
|
||||
write("Non-cube Squares (21st to 30th):")
|
||||
every (k := 0, s := noncubesquares()) do
|
||||
if(k +:= 1) > 30 then break
|
||||
else write(20 < k," : ",s)
|
||||
end
|
||||
|
||||
procedure mthpower(m) #: generate i^m for i = 0,1,...
|
||||
while (/i := 0) | (i +:= 1) do suspend i^m
|
||||
end
|
||||
|
||||
procedure noncubesquares() #: filter for squares that aren't cubes
|
||||
cu := create mthpower(3) # co-expressions so that we can
|
||||
sq := create mthpower(2) # ... get our results where we need
|
||||
|
||||
repeat {
|
||||
if c === s then ( c := @cu , s := @sq )
|
||||
else if s > c then c := @cu
|
||||
else {
|
||||
suspend s
|
||||
s := @sq
|
||||
}
|
||||
}
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue