# Definition:Magic Cube

## Definition

A magic cube is an arrangement of the first $n^3$ (strictly) positive integers into an $n \times n \times n$ cubic array such that:

the sum of the entries in each row in each of the $3$ dimensions
the sum of the entries along the space diagonals

are the same.

It is not guaranteed that the entries along each of the main diagonals of each plane also sum to the same constant.

### Perfect Magic Cube

A perfect magic cube is an arrangement of the first $n^3$ (strictly) positive integers into an $n \times n \times n$ cubic array such that:

the sum of the entries in each row in each of the $3$ dimensions
the sum of the entries along the main diagonal of each plane
the sum of the entries along the space diagonals

are the same.

### Order

An $n \times n \times n$ magic cube is called an order $n$ magic cube.

## Examples

### Order $1$

The Order $1$ magic cube is trivial:

$\begin{array}{|c|} \hline 1 \\ \hline \end{array}$

### Order $3$

$\begin{array}{|c|c|c|} \hline 2 & 13 & 27 \\ \hline 22 & 9 & 11 \\ \hline 18 & 20 & 4 \\ \hline \end{array} \qquad \begin{array}{|c|c|c|} \hline 16 & 21 & 5 \\ \hline 3 & 14 & 25 \\ \hline 23 & 7 & 12 \\ \hline \end{array} \qquad \begin{array}{|c|c|c|} \hline 24 & 8 & 16 \\ \hline 17 & 19 & 6 \\ \hline 1 & 15 & 26 \\ \hline \end{array}$