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

Home > Numbers
Sum of Cubes (Posted on 2013-10-23) Difficulty: 2 of 5
Express each integer between 1 and 1000 as a sum of four cubes of integers (which can be positive, negative, or zero).

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts going further with the computer, but still 14 missing | Comment 3 of 5 |
(In reply to Computer findings, leaving 45 cases for analytic methods by Charlie)

31 of the missing 45 are found by:

DEFDBL A-Z

DIM cube(50)

OPEN "sumcubes extra.txt" FOR OUTPUT AS #2
DATA 31,50,86,95,148,221,239,265,284,291,292,301,310,356,365,373,382,417,428
DATA 437,499,508,564,571,580,589,598,626,634,643,652,724,725,760,769,778
DATA 787,788,879,886,905,913,914,949,967
DIM needed(45)
FOR i = 1 TO 45
    READ needed(i)
NEXT

FOR n = 0 TO 50
    cube(n) = n * n * n: PRINT n, cube(n)
NEXT
FOR asub = 0 TO 50
    FOR bsub = asub TO 50
        FOR csub = bsub TO 50
            FOR dsub = csub TO 50
                FOR a = -cube(asub) TO cube(asub) STEP cube(asub)
                    FOR b = -cube(bsub) TO cube(bsub) STEP cube(bsub)
                        FOR c = -cube(csub) TO cube(csub) STEP cube(csub)
                            FOR d = -cube(dsub) TO cube(dsub) STEP cube(dsub)
                                tot = a + b + c + d
                                good = 0
                                FOR i = 1 TO 45
                                    IF needed(i) = tot THEN good = 1: needed(i) = 0: EXIT FOR
                                NEXT
                                IF good THEN
                                    IF tot > 0 AND tot <= 1000 THEN
                                        PRINT USING "#### = ###### + ####### + ####### + #######"; tot; a; b; c; d
                                        PRINT #2, USING "#### = ###### + ####### + ####### + #######"; tot; a; b; c; d
                                        ct = ct + 1
                                    END IF
                                END IF
                                IF dsub = 0 THEN EXIT FOR
                            NEXT
                            IF csub = 0 THEN EXIT FOR
                        NEXT
                        IF bsub = 0 THEN EXIT FOR
                    NEXT
                    IF asub = 0 THEN EXIT FOR
                NEXT
            NEXT
        NEXT
    NEXT
NEXT
PRINT ct

CLOSE


  50 =  24389 +   24389 +   68921 + -117649
  86 =   2744 +    2744 +   24389 +  -29791
  95 =     -1 +    2744 +    8000 +  -10648
 221 =     -1 +    8000 +   42875 +  -50653
 239 =     -1 +   -2197 +  -21952 +   24389
 291 =   1000 +    1728 +   21952 +  -24389
 292 =  -1331 +   -4913 +  -32768 +   39304
 301 =     -8 +  -17576 +  -32768 +   50653
 310 =      1 +  -17576 +  -32768 +   50653
 365 =    125 +   -2197 +  -21952 +   24389
 373 =      1 +    6859 +   97336 + -103823
 417 =     -8 +   -2744 +  -32768 +   35937
 428 =    -64 +   -6859 + -117649 +  125000
 437 =   -343 +   -2197 +  -29791 +   32768
 499 = -17576 +  -24389 +  -54872 +   97336
 508 =   1000 +    6859 +  117649 + -125000
 564 =     -1 +    4913 +    4913 +   -9261
 589 =     64 +    4096 +   39304 +  -42875
 634 =   6859 +    6859 +   29791 +  -42875
 643 =   -125 +   21952 +   64000 +  -85184
 652 =    343 +  -17576 +  -32768 +   50653
 760 =     -8 +   21952 +   64000 +  -85184
 769 =      1 +   21952 +   64000 +  -85184
 778 =     64 +   -2744 +  -12167 +   15625
 788 =      8 +   -2197 +  -29791 +   32768
 879 =    -64 +    2744 +   13824 +  -15625
 886 =     64 +   -4913 +   -4913 +   10648
 905 =    125 +   -2197 +  -29791 +   32768
 913 =  -4913 +   -8000 + -103823 +  117649
 914 =  -2197 +   -2197 +   -6859 +   12167
 967 =   4096 +   21952 +   29791 +  -54872


  Posted by Charlie on 2013-10-23 12:55:41
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (8)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information