DEFDBL A-Z
OPEN "2posssum.txt" FOR OUTPUT AS #2
FOR a = 1 TO 150
PRINT a;
ac = a * a * a
FOR b = a TO 150
bc = b * b * b
FOR c = b TO 150
cc = c * c * c
sum = ac + bc + cc
PRINT #2, USING "######### ### ### ### ######### ######### #########"; sum; a; b; c; ac; bc; cc
NEXT
NEXT
NEXT
CLOSE
produces a file, which is then sorted and then read by:
DEFDBL A-Z
CLS
OPEN "2posssum.txt" FOR INPUT AS #1
DO
LINE INPUT #1, l$
IF LEFT$(l$, 10) = LEFT$(p$, 10) THEN
PRINT p$: PRINT l$: PRINT
ct = ct + 1
IF ct > 10 THEN END
END IF
p$ = l$
LOOP UNTIL EOF(1)
which produces the first few pairs of the type requested:
bases of
sum cubes cubes
251 1 5 5 1 125 125
251 2 3 6 8 27 216
1009 4 6 9 64 216 729
1009 1 2 10 1 8 1000
1366 2 3 11 8 27 1331
1366 5 8 9 125 512 729
1457 6 8 9 216 512 729
1457 1 5 11 1 125 1331
1459 4 4 11 64 64 1331
1459 1 9 9 1 729 729
1520 2 8 10 8 512 1000
1520 4 5 11 64 125 1331
1730 1 9 10 1 729 1000
1730 1 1 12 1 1 1728
1737 1 2 12 1 8 1728
1737 2 9 10 8 729 1000
1756 1 3 12 1 27 1728
1756 3 9 10 27 729 1000
1763 2 3 12 8 27 1728
1763 6 6 11 216 216 1331
1793 1 4 12 1 64 1728
1793 4 9 10 64 729 1000
so 251 is the first member of the series that allows more than one representation as the sum of positive cubes.
If the cubes needed to be distinct then the smallest would be 1009.
|
Posted by Charlie
on 2013-11-08 17:25:13 |