# Gold Cubes A rich man collects a series of 12 solid gold cubes over his lifetime. The first cube has dimensions 1×1×1, the second 2×2×2, all the way to 12×12×12.
He has two children, and wishes to leave the gold cubes fairly between them in his will. If we assume that a cube’s value is purely based on the weight of the gold, and the cubes cannot be subdivided, how should the man distribute the cubes? The first thing to remember, is that the mass of a gold cube is proportional to cubic power of exterior dimension. The 2×2×2 cube has a mass eight times that of the 1×1×1 cube. The 12×12×12 has a mass 1,728 times that of the 1×1×1 cube.

## Solution

There is only one distinct solution to the 12 cube problem (well, there are two mirror image solutions: one solution in which the first child gets cubes 1,2,4,8,9,12 and the second where his sibling gets these, and she gets the complement). Interestingly, they both get six cubes.
The solutions are in the table below. The column headings show the cube number.
1 2 3 4 5 6 7 8 9 10 11 12
1 1 2 1 2 2 2 1 1 2 2 1
2 2 1 2 1 1 1 2 2 1 1 2
I solved the puzzle using a brute force approach. I represented the system as a binary number of 12 digits (one digit for each cube). A 'zero' in a position meant that the first child get the cube, and a 'one' in any digit meant the second child did. Quickly iterating through the numbers 000000000000–111111111111 goes through all permutations. By summing up the masses of the corresponding bits, the total to be received by that child can be determined. Of course you only need to do the total for one child. There's a little bit of optimization that can be performed early to short circuit and skip when the running total gets over half, but the code does not take that long to run anyway.

## More Cubes

What if the man collected more cubes before he died?
There are no solutions for N<12, nor for N=13, N=14, but at N=15 there are two possible solutions (along with their mirror images).
There are solutions for N=16, N=19, N=20, N=23, N=24 (a lot of them!)
It’s easy to see that some number of cubes can’t be solved. For instance, N=25 would never be possible because the total mass of the cubes is 105,625 which is odd. As we can’t subdivide a cube there is no way for each child to get exactly half.

## N=15

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 1 2 2 2 2 1 2 1 2 2 2 2 1 1
2 2 1 2 1 1 2 2 1 1 2 1 2 2 1
1 1 2 1 2 2 1 1 2 2 1 2 1 1 2
2 2 1 1 1 1 2 1 2 1 1 1 1 2 2

## N=16

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 2 1 2 1 1 2 2 1 1 2 1 2 2 1
2 1 1 2 1 2 2 1 1 2 2 1 2 1 1 2

## N=19

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
2 2 1 1 2 2 1 2 2 1 2 1 1 2 2 2 2 1 1
1 2 2 1 2 1 1 2 1 1 2 1 1 2 2 2 1 2 1
2 1 1 2 1 2 2 1 2 2 1 2 2 1 1 1 2 1 2
1 1 2 2 1 1 2 1 1 2 1 2 2 1 1 1 1 2 2

## Sum of three cubes

A vaguely related problem is the one covered in detail by the excellent channel Numberphile about a problem posed in 1953 which has recently been solved. It’s a simple enough conjecture, and that’s to see if it possible to write a number as the sum of three cubes.
For example, we knew we could write 3 as 1³ + 1³ + 1³ and also as 4³ + 4³ + (−5)³, but for over 60 years mathematicians wondered if there was another way. This past September, Andrew Booker and Andrew Sutherland finally found a third solution:
3 = 569,936,821,221,962,380,7203 + (−569,936,821,113,563,493,509)3 + (−472,715,493,453,327,032)3