Taxicab numbers: Difference between revisions

Line 3,159:
140 NEXT m
150 NEXT x
160 IF k=1 THEN LET q=m: LET r=n: GO TO 220230: REM got one!
170 LET o=m
180 LET p=n
Line 3,166:
210 NEXT m
220 NEXT x
220230 LET c=c+1
230240 IF c>25 AND c<2000 THEN GO TO 320330
240250 LET t$="": REM convert number to string; while ZX Spectrum Basic can store all the digits of integers up to 2^32-1...
250260 LET t=INT (x/100000): REM ...it will resort to scientific notation trying to display any more than eight digits
260270 LET b=x-t*100000
270280 IF t=0 THEN GO TO 290: REM omit leading zero
280290 LET t$=STR$ t
290300 LET t$=t$+STR$ b
300310 PRINT c;":";t$;"=";q;"^3+";r;"=";o;"^3+";r;"^3"
310320 POKE 23692,10: REM suppress "scroll?" prompt when screen fills up at c=22
320330 IF c=2006 THEN LET x=4294967295: LET n=1626: LET m=1626
330340 NEXT n
340350 NEXT m
350360 NEXT x</lang>
 
{{out}}
77

edits