# Perfect magic 4x4 square

Can you fill a 4x4 grid with every number from 1 to 16, such that every row, every column and every 2x2 sub-grid of numbers sum to the same value?

Solution:

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


Notes:

     A B C D
E F G H
I J K L
M N O P


Must have
A+B = G+H = I+J = O+P
C+D = E+F = K+L = M+N
A+E = J+N = C+G = L+P
I+M = B+F = K+O = D+H
B+C = J+K = E+H = M+P
F+G = N+O = A+D = I+L
E+I = G+K = B+N = D+P
F+J = H+L = A+M = C+O
which are enough constraints to make it manageable by trial and error.

This one has a kind of rhythm I find cool:

1 16 2 15
14 3 13 4
12 5 11 6
7 10 8 9
• The central 2x2 appears to sum to 32 only. Apr 6, 2021 at 17:22
• @loopywalt thats correct, my mistake, I forgot to consider this one. It appears that exchanging rows 3 and 4 fixes it. Then it is interesting to note that it gives a solution similar to yours but with columns 2 and 4 exchanged. So it seems there are not plenty of solutions...
– Fred
Apr 12, 2021 at 15:05
1 16 5 12
8 9 4 13
3 14 7 10
15 2 11 6

Each 2x2 square should be (largest + smallest) * 4 / 2. In this case that would be 34.

• You forgot the columns, they don't add up properly. Apr 6, 2021 at 14:22
• Ah yes, I didn't notice that. Apr 7, 2021 at 2:25