# Create a 4-by-4 regular square

We can say that an $n$-by-$n$ square is regular provided that:

1. Each of the integers from $0$ to $n^2 − 1$ appears in exactly one cell, and each cell contains only one integer (so that the square is filled), and

2. If we express the entries in base-$n$ form, each base-$n$ digit occurs exactly once in the units’ position, and exactly once in the $n$’s position.

Example with 3-by-3 regular square:

The square is regular because each of the ternary digits $0$, $1$, and $2$ appears exactly once in the units’ and $3$’s position in each row and each column.

Can someone help me construct an example of a 4-by-4 regular square, showing my answer in both decimal and base-$4$ notations.

## 1 Answer

I didn't come up with any particular way to generate one, but I did come up with one by working the 4s place first then the unit place, generally swapping things around when I backed myself into a corner.

$\begin{pmatrix} 00 & 23 & 32 & 11 \\ 21 & 02 & 13 & 30 \\ 12 & 31 & 20 & 03 \\ 33 & 10 & 01 & 22 \end{pmatrix} = \begin{pmatrix} 0 & 11 & 14 & 5 \\ 9 & 2 & 7 & 12 \\ 6 & 13 & 8 & 3 \\ 15 & 4 & 1 & 10 \end{pmatrix}$

• Yes this works!!. Feb 20, 2015 at 20:41
• The solution of the 4X4 is not right. The diagonals are 20 and 40. they should be 30 and 30.
– Moti
Feb 21, 2015 at 6:33
• That wasn't specified in the problem definition, and the 3x3 example has a diagonal of sum 3. Feb 23, 2015 at 15:55