Pandiagonal magic square


A pandiagonal magic square or panmagic 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 pandiagonal magic square can be regarded as having orientations.

3×3 pandiagonal magic squares

It can be shown that non-trivial pandiagonal magic squares of order 3 do not exist. Suppose the square
is pandiagonally magic with magic sum. Adding sums and results in. Subtracting and we get.
However, if we move the third column in front and perform the same proof, we obtain. In fact, using the symmetries of 3 × 3 magic squares, all cells must equal. Therefore, all 3 × 3 pandiagonal magic squares must be trivial.
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.

4×4 pandiagonal magic squares

The smallest non-trivial pandiagonal magic squares are squares. All pandiagonal magic squares must be translationally symmetric to the form
aa + b + c + ea + c + da + b + d + e
a + b + c + da + d + ea + ba + c + e
a + b + ea + ca + b + c + d + ea + d
a + c + d + ea + b + da + ea + b + c

Since each subsquare sums to the magic constant, pandiagonal magic squares are most-perfect magic square. In addition, the two numbers at the opposite corners of any square add up to half the magic sum. Consequently, all pandiagonal magic squares that are associative must have duplicate cells.
All 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
181312
141127
45169
151036

The number of pandiagonal magic squares using numbers 1-16 without duplicates is 384.

5×5 pandiagonal magic squares

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:
20821142
114171023
72513119
31692215
24125186

In addition to the rows, columns, and diagonals, a 5 × 5 pandiagonal magic square also shows its magic sum in four "quincunx" patterns, which in the above example are:
Each of these quincunxes can be translated to other positions in the square by cyclic permutation of the rows and columns, which in a pandiagonal magic square does not affect the equality of the magic sums. 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
with magic sum. To prove the quincunx sum , we can add together the following:
From this sum, subtract the following:
The net result is, which divided by 5 gives the quincunx sum. Similar linear combinations can be constructed for the other quincunx patterns,, and.

(4''n''+2)×(4''n''+2) pandiagonal magic squares with nonconsecutive elements

No pandiagonal magic square exists of order if consecutive integers are used. But certain sequences of nonconsecutive integers do admit order- pandiagonal magic squares.
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:
An additional equal partitioning of the sum of squares guarantees the semibimagic property noted below:
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 6x6 pandigonal patterns and, respectively given by:
156732
561327
615273
156732
561327
615273

651651
165165
516516
237237
723723
372372

Then gives the nonconsecutive pandiagonal 6x6 square:
6333648198
29415151347
40134124320
23142441714
3537321945
38730104916

with a maximum element of 49 and a pandiagonal magic sum of 150.
This square is pandiagonal and semibimagic, 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:
This leads to squares having a maximum element of 169 and a pandiagonal magic sum of 850, which are also semibimagic with each row or column sum of squares equal to 102,850.

(6''n''±1)×(6''n''±1) pandiagonal magic squares

A pandiagonal magic square can be built by the following algorithm.

4''n''×4''n'' pandiagonal magic squares

A pandiagonal magic square can be built by the following algorithm.
If we build a pandiagonal magic square with this algorithm then every square in the square will have the same sum. Therefore, many symmetric patterns of cells have the same sum as any row and any column of the square. Especially each and each rectangle will have the same sum as any row and any column of the square. The square is also a Most-perfect magic square.

(6''n''+3)×(6''n''+3) pandiagonal magic squares

A pandiagonal magic square can be built by the following algorithm.