On the Subject of Magic Cube

Like a magic square, only in 3D

Normally this module would generate a magic cube, but something went wrong and it got shuffled.

What to do

To solve this module, the magic cube needs to be fixed.

In order to do this, press any of the arrow buttons to shift that row or column in that direction.

The top left screen shows the currently selected 3×3 layer of the magic cube.

Press the button to the right of that screen to switch between layers.

What is a magic cube

A magic cube is a n×n×n cube with numbers in each cell ranging from 1 to n³ once each in such a way that the sums of the numbers on each row, each column, each pillar and on each of the four main space diagonals are equal to the magic constant.

The magic constant is calculated with the following formula: M = (n(n³+1))/2.

Each number may be modified by the same offset x. In this case, the magic constant is M = M+3x.