This commit is contained in:
Ingy döt Net 2013-04-10 21:29:02 -07:00
parent 764da6cbbb
commit db842d013d
19005 changed files with 197040 additions and 7 deletions

View 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