ESP
• Electronics
• Mathematics
• Programs
• Contact

# Sum of cubes

This applet finds the decomposition of any integer number not congruent to 4 or 5 (mod 9) into a sum of four cubes.

The applet uses the following formulas:

• 6x = (x - 1)3 + (-x)3 + (-x)3 + (x + 1)3
• 6x + 3 = x3 + (-x + 4)3 + (2x - 5)3 + (-2x + 4)3
• 18x + 1 = (2x + 14)3 + (-2x - 23)3 + (-3x - 26)3 + (3x + 30)3
• 18x + 7 = (x + 2)3 + (6x - 1)3 + (8x - 2)3 + (-9x + 2)3
• 18x + 8 = (x - 5)3 + (-x + 14)3 + (-3x + 29)3 + (3x - 30)3
• 54x + 20 = (3x - 11)3 + (-3x + 10)3 + (x + 2)3 + (-x + 7)3
• 72x + 56 = (-9x + 4)3 + (x + 4)3 + (6x - 2)3 + (8x - 4)3
• 108x + 2 = (-x - 22)3 + (x + 4)3 + (-3x - 41)3 + (3x + 43)3
• 216x + 92 = (3x - 164)3 + (-3x + 160)3 + (x - 35)3 + (-x + 71)3
• 270x + 146 = (-60x + 91)3 + (-3x + 13)3 + (22x - 37)3 + (59x - 89)3
• 270x + 200 = (3x + 259)3 + (-3x - 254)3 + (x + 62)3 + (-x - 107)3
• 270x + 218 = (-3x - 56)3 + (3x + 31)3 + (-5x - 69)3 + (5x + 78)3
• 432x + 380 = (-3x + 64)3 + (3x - 80)3 + (2x - 29)3 + (-2x + 65)3
• 540x + 38 = (5x - 285)3 + (-5x + 267)3 + (3x - 140)3 + (-3x + 190)3
• 810x + 56 = (5x - 755)3 + (-5x + 836)3 + (9x - 1445)3 + (-9x + 1420)3
• 1080x + 380 = (-x - 1438)3 + (x + 1258)3 + (-3x - 4037)3 + (3x + 4057)3
• 1620x + 1334 = (-5x - 3269)3 + (5x + 3107)3 + (-9x - 5714)3 + (9x + 5764)3
• 1620x + 1352 = (-5x + 434)3 + (5x - 353)3 + (9x - 722)3 + (-9x + 697)3
• 2160x + 362 = (-5x - 180)3 + (5x + 108)3 + (-6x - 149)3 + (6x + 199)3
• 6480x + 794 = (-5x - 83)3 + (5x + 11)3 + (-6x - 35)3 + (6x + 85)3

If n = 164, 596, 1892, 2324, 2756, 4052, 4484 (mod 6480) the following formula is used:

54x + 2 = (29484x2 + 2211x + 43)3 + (-29484x2 - 2157x - 41)3 + (9828x2 + 485x + 4)3 + (-9828x2 - 971x - 22)3

If n = 254, 902, 1442, 1874, 1982, 2414, 3062, 3494, 3602, 4034, 4142, 5114, 5222, 5654, 5762, 6302 (mod 6480) a method due to Demjanenko is used. Notice that the results can have hundreds of digits in this case.

In the remaining cases the number n is replaced by -n and then all solutions are multiplied by -1.

If you find any error or you have a comment, please fill in the form.

Written by Dario Alpern.

## Source code

You can download the source of the current program and the old sum of four cubes applet from here. Notice that the source code is in C language and you need the Emscripten environment in order to generate Javascript.

You can also enter expressions that use the following operators and parentheses: