Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
10 DIM f(1625): REM populating a cube table at the start will be faster than computing the cubes on the fly
|
||||
20 FOR x=1 TO 1625
|
||||
30 LET f(x)=x*x*x: REM x*x*x rather than x^3 as the ZX Spectrum's exponentiation function is legendarily slow
|
||||
40 NEXT x
|
||||
50 LET c=0
|
||||
60 FOR x=1 TO 4294967295: REM the highest number the ZX Spectrum Basic can accurately hold internally; floor (cuberoot max)=1625, hence the table limit
|
||||
70 LET k=0
|
||||
80 FOR m=1 TO 1625
|
||||
90 FOR n=m+1 TO 1625
|
||||
100 IF f(m)+f(n)=x THEN GOTO 160
|
||||
110 IF f(n)>=x THEN LET n=1625: REM overshot, break out of the loop
|
||||
120 IF f(m)>=x THEN LET m=1625
|
||||
130 NEXT n
|
||||
140 NEXT m
|
||||
150 NEXT x
|
||||
160 IF k=1 THEN LET q=m: LET r=n: GO TO 230: REM got one!
|
||||
170 LET o=m
|
||||
180 LET p=n
|
||||
190 LET k=1
|
||||
200 NEXT n
|
||||
210 NEXT m
|
||||
220 NEXT x
|
||||
230 LET c=c+1
|
||||
240 IF c>25 AND c<2000 THEN GO TO 330
|
||||
250 LET t$="": REM convert number to string; while ZX Spectrum Basic can store all the digits of integers up to 2^32-1...
|
||||
260 LET t=INT (x/100000): REM ...it will resort to scientific notation trying to display any more than eight digits
|
||||
270 LET b=x-t*100000
|
||||
280 IF t=0 THEN GO TO 300: REM omit leading zero
|
||||
290 LET t$=STR$ t
|
||||
300 LET t$=t$+STR$ b
|
||||
310 PRINT c;":";t$;"=";q;"^3+";r;"^3=";o;"^3+";p;"^3"
|
||||
320 POKE 23692,10: REM suppress "scroll?" prompt when screen fills up at c=22
|
||||
330 IF c=2006 THEN LET x=4294967295: LET n=1625: LET m=1625
|
||||
340 NEXT n
|
||||
350 NEXT m
|
||||
360 NEXT x
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
10 LET T=0: DIM F(72): LET D=0: LET S=0: LET B=0: LET A=0: LET C=0
|
||||
20 DIM H(50): DIM Y(50,2): FOR D=1 TO 72: LET F(D)=D*D*D: NEXT D
|
||||
30 FOR A=1 TO 58: FOR B=A+1 TO 72: LET S=F(A)+F(B): FOR D=B-1 TO A STEP -1
|
||||
40 LET T=S-F(D): IF T>F(D) THEN NEXT B: NEXT A: GO TO 90
|
||||
45 IF s>405224 THEN GO TO 70
|
||||
50 IF F(INT (EXP (LN (T)/3)+.5))=T THEN GO TO 80
|
||||
60 NEXT D
|
||||
70 NEXT B: NEXT A: GO TO 90
|
||||
80 PRINT S,: LET C=C+1: LET H(C)=S: LET Y(C,1)=A*65536+B: LET Y(C,2)=INT (EXP (LN (T)/3)+.5)*65536+D: GO TO 70
|
||||
90 LET S=INT (C/2)
|
||||
100 LET T=0: FOR A=1 TO C-S: IF H(A)>H(A+S) THEN LET T=H(A): LET H(A)=H(A+S): LET H(A+S)=T: LET T=Y(A,1): LET Y(A,1)=Y(A+S,1): LET Y(A+S,1)=T: LET T=Y(A,2): LET Y(A,2)=Y(A+S,2): LET Y(A+S,2)=T
|
||||
110 NEXT A: IF T<>0 THEN GO TO 100
|
||||
120 IF S<>1 THEN LET S=INT (S/2): GO TO 100
|
||||
130 CLS : FOR A=1 TO 25: PRINT A;":";H(A);"=";
|
||||
131 LPRINT A;":";H(A);"=";:
|
||||
140 LET T=INT (Y(A,1)/65536): PRINT T;"^3+";Y(A,1)-T*65536;"^3=";
|
||||
141 LPRINT T;"^3+";Y(A,1)-T*65536;"^3=";
|
||||
150 LET T=INT (Y(A,2)/65536): PRINT T;"^3+";Y(A,2)-T*65536;"^3"
|
||||
151 LPRINT T;"^3+";Y(A,2)-T*65536;"^3"
|
||||
160 NEXT A: PRINT
|
||||
170 STOP
|
||||
Loading…
Add table
Add a link
Reference in a new issue