Sum of Three Cubes Puzzle

June 19th, 2012 | Categories: general math | Tags:

It is possible to write many integers as the sum of the cubes of three integers.  For example

99 = (-5)^3 + 2^3+ 6^3

A more complicated example is

91 = (-67134)^3 + (-65453)^3+(83538)^3

Your task is to find integers x,y and z such that

33 = x^3 + y^3 + z^3

Hint: This is not a trivial problem and will (probably) require the use of a computer. Extra credit given if you also post your source code.

Update 3: If you are serious about attempting to crack this problem (and some people seem to be, judging from the comments), the following reference may be of help.  The bibliography includes other jumping off points for this problem.

  • Michael Beck, Eric Pine, Wayne Tarrant and Kim Yarbrough Jensen: New integer representations as the sum of three cubes Math. Comp. 76 (2007), 1683-1690 (Link)

Update 2: This problem is, in fact, a long-standing unsolved problem in number theory.  If my memory serves me correctly, it is mentioned in the book Unsolved Problems in Number Theory

Update 1: 33 is very VERY difficult so why not use 16 as a warm up problem. MUCH smaller search space.

  1. Alex Wilson
    June 19th, 2012 at 14:09
    Reply | Quote | #1


    Code, in Scala:

    val r = (-100000 to 100000)
    for ( x <- r; y <- r; z <- r ) { if ( (x*x*x+y*y*y+z*z*z) == 33 ) println( x, y, z ) }

  2. Alex Wilson
    June 19th, 2012 at 14:32
    Reply | Quote | #2

    A faster search (n^2 rather than n^3 on the search limits):

    val r = (-100000 to 100000)
    for ( x <- r; y <- r; val z = scala.math.cbrt(33.0 – (x*x*x + y*y*y)).toInt ) { if ( (x*x*x+y*y*y+z*z*z) == 33.0 ) println( x, y, z ) }

  3. June 19th, 2012 at 14:51
    Reply | Quote | #3

    Hi Alex

    I’m afraid not

    (-100000)^3 + (-99735)^3 + (-23878)^3 = -2005689597689823

    See Wolfram Alpha for instance^3+%2B+%28-99735%29^3+%2B+%28-23878%29^3

    You’ll need to copy and paste the link above. My blog software has truncated the clickable version for some reason

    methinks you have an overflow error of some type :)

  4. ludolph
    June 19th, 2012 at 15:42
    Reply | Quote | #4

    Mike, this is really hard problem!!??

  5. June 19th, 2012 at 15:48
    Reply | Quote | #5

    Hi ludoph

    I wondered how long it would take for someone to find that :)

    Indeed it is hard, one of the unsolved problems in number theory in fact. Here’s another useful link

    I find it fascinating that the problem is so easy to state that you can explain it to a child and it is also easy to start to develop algorithms to try to solve it yet no one has ever managed to solve it. You quickly hit limits with a simple search (such as the maximum hardware integer problem that Alex ran into).

    Perhaps now is a good time to resurrect the search? Computers have become a lot more powerful (and parallel!) in recent times.

  6. Alex Wilson
    June 19th, 2012 at 15:49
    Reply | Quote | #6

    @Mike Croucher
    You are of-course correct. That’ll teach me to check my answers properly… :-)

  7. June 19th, 2012 at 15:52
    Reply | Quote | #7

    No worries Alex, if it’s any consolation I made a very similar mistake when I first tried to solve it :)

  8. ludolph
    June 19th, 2012 at 16:02
    Reply | Quote | #8

    @Mike Croucher
    Here is very intersting list of known solution up to n=1000

  9. Alex Wilson
    June 19th, 2012 at 16:03
    Reply | Quote | #9

    @Mike Croucher
    Here are a bunch for 16:


    Having glanced at the link above, I’m not sure I have the available computing hardware to attack the problem with n=33. So I shall retire from the fight…

  10. June 19th, 2012 at 16:22

    Thanks for the list ludolph. All that work and STILL no solution for 33 or 42.

    I wonder if there is some interesting reason why some are so easy while others are so very hard.

  11. ludolph
    June 19th, 2012 at 16:40

    @Mike Croucher

    Hard problems have always interesting reasons … this is why I love mathematics and physics.

  12. hapm
    June 20th, 2012 at 00:40

    I’m glad I read the comments before my laptop melted searching for the result, it was already at 90C :)

  13. Shahar
    June 20th, 2012 at 09:03

    Had I not read the comments I would have most definitely wasted the rest of the week (and the weekend most likely) trying to solve this.

  14. June 20th, 2012 at 09:43

    Its a shame you read the comments then. It’s possible that you might have solved it with some innovative way of thinking.

  15. Shahar
    June 20th, 2012 at 12:29

    I’m actually working on it anyway :-)
    There goes my weekend!

  16. June 20th, 2012 at 13:35

    Which language are you working in?

  17. Shahar
    June 21st, 2012 at 10:16

    I’m trying to get something going within Mathematica 8 on a machine with 200 cores.

  18. June 21st, 2012 at 11:13

    Cool! I’d suggest that you have a read of the paper I mentioned in ‘update 3’ of this blog post. A simple search isn’t going to work I think?

  19. Shahar
    June 21st, 2012 at 12:50

    Yes, I got that. As of now I can’t even get 75, 52, 50, 30.
    Can’t say that I have a lead on a really wise approach.

  20. Kai Rowe
    March 30th, 2017 at 21:26

    I wrote a simple code in python to do this… at the current rate it would take my computer over 100 centuries to crunch through the range(-10^14, 10^14)….. I do have a quad core and I’m only taking advantage of 1 thread. using them all would still take me over 3 years though…

  21. Maciej Kmieciak
    March 12th, 2019 at 12:22

    33 = (8866128975287528)^3 + (−8778405442862239)^3 + (−2736111468807040)^3
    Numberphile video:

    PS: What about integers >1000? Any work has been done?