Problem #419

Enumerating the magic cubes
Public 08/11/17 8xp Programming 72.7%

A magic cube is the 3-D equivalent of a magic square.

Here is an exemple of a $3 \times 3 \times 3$ magic cube with all integers from 1 to 27:

- The sum of all rows and columns in the 3 directions are equals

- The sum of the 4 main diagonals are equals

How many $3 \times 3 \times 3$ magic cubes with integers in $\{ 1, \dots , 27 \}$ are there ?

Answer format: (Count) (colon) (comma separated list of values for the cube of rank 123).

Example : 999:4,17,21,18,19,5,20,6,16,26,3,13,1,14,27,15,25,2,12,22,8,23,9,10,7,11,24
(Corresponds to the cube in the above picture)

[My timing: 2 min]
We ignore symmetries : facing the 6 faces of this example, we get 6 distinct solutions.
To rank the cubes, represent them as a 27 elements vectors (as in the above example), then sort the vectors in lexicographic order.

You need to be a member to keep track of your progress.

Time may end, but hope will last forever.

Other Challenge Sites