All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Ramanujan enforced. (Posted on 2010-08-02)
1,729 is the least integer which equals the sum of two positive cubes in two different ways (see "taxicab number" on the web):
1,729 = 12^3+1^3 and 1,729 = 10^3+9^3.

a) Find an integer which equals the sum of two positive cubes in THREE different ways.
There is more than one solution.

b) Erasing the word "positive" in the 1st statement allows a lesser positive integer(s??) number(s??) to be presented as a sum of two cubes in two different ways.
Find it (them??).

 See The Solution Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 2 of 5 |

Part A:

DEFDBL A-Z
OPEN "ramanuj.txt" FOR OUTPUT AS #2
FOR a = 1 TO 1000
a3 = a * a * a
FOR b = a TO 1000
b3 = b * b * b
v = a3 + b3
PRINT #2, USING "#### #### ###########"; a; b; v
NEXT
NEXT
CLOSE

Then, the ramanuj.txt file was sorted on the total value (v), and read by the following program:

OPEN "ramanuj.txt" FOR INPUT AS #1
CLS
DO
pprevl\$ = prevl\$
prevl\$ = l\$
LINE INPUT #1, l\$
pprevn\$ = prevn\$
prevn\$ = n\$
n\$ = MID\$(l\$, 12, 10)
IF n\$ = pprevn\$ THEN
IF flag = 0 THEN PRINT pprevl\$: PRINT prevl\$: ct = ct + 2
flag = 1
PRINT l\$: ct = ct + 1
ELSE
IF flag THEN PRINT : ct = ct + 1
IF ct > 40 THEN ct = 0: DO: LOOP UNTIL INKEY\$ > ""
flag = 0
END IF
LOOP UNTIL EOF(1)
CLOSE

which found the following as the first few values that each had three ways of being produced by the sum of positive cubes (the cube roots of the cubes are shown, together with the sum of the cubes):

`167  436    87539319228  423    87539319255  414    87539319`
` 11  493   119824488 90  492   119824488346  428   119824488`
`359  460   143604279408  423   143604279111  522   143604279`
`315  525   175959000 70  560   175959000198  552   175959000`
`300  670   327763000339  661   327763000510  580   327763000`
`510  828   700314552334  872   700314552456  846   700314552`
`295  920   804360375 15  930   804360375198  927   804360375`
`692  856   958595904 22  986   958595904180  984   958595904`

Part B:

DEFDBL A-Z
OPEN "ramanub.txt" FOR OUTPUT AS #2
FOR a = -1000 TO 1000
a3 = a * a * a
FOR b = ABS(a) TO 1000
b3 = b * b * b
v = a3 + b3
PRINT #2, USING "##### ##### ###########"; a; b; v
NEXT
NEXT
CLOSE

Then, the ramanuB.txt file was sorted on the total value (v), and zero values eliminated, and read by the following program:

OPEN "ramanub.txt" FOR INPUT AS #1
CLS
DO
pprevl\$ = prevl\$
prevl\$ = l\$
LINE INPUT #1, l\$
pprevn\$ = prevn\$
prevn\$ = n\$
n\$ = MID\$(l\$, 14, 10)
IF n\$ = prevn\$ THEN
IF flag = 0 THEN PRINT prevl\$: ct = ct + 1
flag = 1
PRINT l\$: ct = ct + 1
ELSE
IF flag THEN PRINT : ct = ct + 1
IF ct > 40 THEN ct = 0: DO: LOOP UNTIL INKEY\$ > ""
flag = 0
END IF
LOOP UNTIL EOF(1)
CLOSE

Results include not only the first few sums of two cubes in two ways but also the first achievable in three ways: 728. The results are shown to the first one that's beyond Ramanujan's 1729:

`  3     4          91 -5     6          91`
` -4     6         152  3     5         152`
` -3     6         189  4     5         189`
`  1     6         217 -8     9         217`
` -6     9         513  1     8         513`
` -2     9         721-15    16         721`
`-10    12         728  6     8         728 -1     9         728`
` -9    12         999 -1    10         999`
`-18    19        1027  3    10        1027`
` -8    12        1216  6    10        1216`
` -6    12        1512  8    10        1512`
`  9    10        1729  1    12        1729`
`-16    18        1736  2    12        1736`
`  9    12        2457-15    18        2457`

 Posted by Charlie on 2010-08-02 16:03:48

 Search: Search body:
Forums (0)