A pandiagonal magic square or panmagic square (also diabolic square, diabolical square or diabolical magic square) is a magic square with the additional property that the broken diagonals, i.e. the diagonals that wrap round at the edges of the square, also add up to the magic constant.
A pandiagonal magic square remains pandiagonally magic not only under rotation or reflection, but also if a row or column is moved from one side of the square to the opposite side. As such, an
n x n
8n2
It can be shown that non-trivial pandiagonal magic squares of order 3 do not exist. Suppose the square
\begin{array}{|c|c|c|} \hline a11&a12 &a13\\ \hline a21&a22 &a23\\ \hline a31&a32 &a33\\ \hline \end{array}
However, if the magic square concept is generalized to include geometric shapes instead of numbers – the geometric magic squares discovered by Lee Sallows – a 3 × 3 pandiagonal magic square does exist.
The smallest non-trivial pandiagonal magic squares are 4 × 4 squares. All 4 × 4 pandiagonal magic squares must be translationally symmetric to the form[1]
a | a + b + c + e | a + c + d | a + b + d + e | |
a + b + c + d | a + d + e | a + b | a + c + e | |
a + b + e | a + c | a + b + c + d + e | a + d | |
a + c + d + e | a + b + d | a + e | a + b + c |
Since each 2 × 2 subsquare sums to the magic constant, 4 × 4 pandiagonal magic squares are most-perfect magic squares. In addition, the two numbers at the opposite corners of any 3 × 3 square add up to half the magic constant. Consequently, all 4 × 4 pandiagonal magic squares that are associative must have duplicate cells.
All 4 × 4 pandiagonal magic squares using numbers 1-16 without duplicates are obtained by letting equal 1; letting,,, and equal 1, 2, 4, and 8 in some order; and applying some translation. For example, with,,, and, we have the magic square
1 | 12 | 7 | 14 | |
8 | 13 | 2 | 11 | |
10 | 3 | 16 | 5 | |
15 | 6 | 9 | 4 |
The number of 4 × 4 pandiagonal magic squares using numbers 1-16 without duplicates is 384 (16 times 24, where 16 accounts for the translation and 24 accounts for the 4! ways to assign 1, 2, 4, and 8 to,,, and).
There are many 5 × 5 pandiagonal magic squares. Unlike 4 × 4 pandiagonal magic squares, these can be associative. The following is a 5 × 5 associative pandiagonal magic square:
20 | 8 | 21 | 14 | 2 | |
11 | 4 | 17 | 10 | 23 | |
7 | 25 | 13 | 1 | 19 | |
3 | 16 | 9 | 22 | 15 | |
24 | 12 | 5 | 18 | 6 |
In addition to the rows, columns, and diagonals, a 5 × 5 pandiagonal magic square also shows its magic constant in four "quincunx" patterns, which in the above example are:
17+25+13+1+9 = 65 (center plus adjacent row and column squares)
21+7+13+19+5 = 65 (center plus the remaining row and column squares)
4+10+13+16+22 = 65 (center plus diagonally adjacent squares)
20+2+13+24+6 = 65 (center plus the remaining squares on its diagonals)
Each of these quincunxes can be translated to other positions in the square by cyclic permutation of the rows and columns (wrapping around), which in a pandiagonal magic square does not affect the equality of the magic constants. This leads to 100 quincunx sums, including broken quincunxes analogous to broken diagonals.
The quincunx sums can be proved by taking linear combinations of the row, column, and diagonal sums. Consider the pandiagonal magic square
\begin{array}{|c|c|c|c|c|} \hline a11&a12&a13&a14&a15\\ \hline a21&a22&a23&a24&a25\\ \hline a31&a32&a33&a34&a35\\ \hline a41&a42&a43&a44&a45\\ \hline a51&a52&a53&a54&a55\\ \hline \end{array}
a11+a15+a33+a51+a55=s
3 times each of the diagonal sums
a11+a22+a33+a44+a55
a15+a24+a33+a42+a51
The diagonal sums
a11+a25+a34+a43+a52
a12+a23+a34+a45+a51
a14+a23+a32+a41+a55
a15+a21+a32+a43+a54
The row sums
a11+a12+a13+a14+a15
a51+a52+a53+a54+a55
The row sums
a21+a22+a23+a24+a25
a41+a42+a43+a44+a45
The column sum
a13+a23+a33+a43+a53
Twice each of the column sums
a12+a22+a32+a42+a52
a14+a24+a34+a44+a54
The net result is
5a11+5a15+5a33+5a51+5a55=5s
a23+a32+a33+a34+a43
a13+a31+a33+a35+a53
a22+a24+a33+a42+a44
No pandiagonal magic square exists of order
4n+2
4n+2
Consider the sum 1+2+3+5+6+7 = 24. This sum can be divided in half by taking the appropriate groups of three addends, or in thirds using groups of two addends:
1+5+6 = 2+3+7 = 12
1+7 = 2+6 = 3+5 = 8
An additional equal partitioning of the sum of squares guarantees the semi-bimagic property noted below:
12 + 52 + 62 = 22 + 32 + 72 = 62
Note that the consecutive integer sum 1+2+3+4+5+6 = 21, an odd sum, lacks the half-partitioning.
With both equal partitions available, the numbers 1, 2, 3, 5, 6, 7 can be arranged into 6 × 6 pandigonal patterns and, respectively given by:
1 | 5 | 6 | 7 | 3 | 2 | |
5 | 6 | 1 | 3 | 2 | 7 | |
6 | 1 | 5 | 2 | 7 | 3 | |
1 | 5 | 6 | 7 | 3 | 2 | |
5 | 6 | 1 | 3 | 2 | 7 | |
6 | 1 | 5 | 2 | 7 | 3 |
6 | 5 | 1 | 6 | 5 | 1 | |
1 | 6 | 5 | 1 | 6 | 5 | |
5 | 1 | 6 | 5 | 1 | 6 | |
2 | 3 | 7 | 2 | 3 | 7 | |
7 | 2 | 3 | 7 | 2 | 3 | |
3 | 7 | 2 | 3 | 7 | 2 |
Then
7A+B-7C
6 | 33 | 36 | 48 | 19 | 8 | |
29 | 41 | 5 | 15 | 13 | 47 | |
40 | 1 | 34 | 12 | 43 | 20 | |
2 | 31 | 42 | 44 | 17 | 14 | |
35 | 37 | 3 | 21 | 9 | 45 | |
38 | 7 | 30 | 10 | 49 | 16 |
with a maximum element of 49 and a pandiagonal magic constant of 150.This square is pandiagonal and semi-bimagic, that means that rows, columns, main diagonals and broken diagonals have a sum of 150 and, if we square all the numbers in the square, only the rows and the columns are magic and have a sum of 5150.
For 10th order a similar construction is possible using the equal partitionings of the sum 1+2+3+4+5+9+10+11+12+13 = 70:
1+3+9+10+12 = 2+4+5+11+13 = 35
1+13 = 2+12 = 3+11 = 4+10 = 5+9 = 14
12 + 32 + 92 + 102 + 122 = 22 + 42 + 52 + 112 + 132 = 335 (equal partitioning of squares; semi-bimagic property)
This leads to squares having a maximum element of 169 and a pandiagonal magic constant of 850, which are also semi-bimagic with each row or column sum of squares equal to 102,850.
A
(6n\pm1) x (6n\pm1)
A
4n x 4n
4n x 4n
2 x 2
4n x 4n
4n
4n x 4n
2n x 2
2 x 2n
4n x 4n
4n x 4n
A
(6n+3) x (6n+3)