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 × n {\displaystyle n\times n} pandiagonal magic square can be regarded as having 8 n 2 {\displaystyle 8n^{2}} 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
a 11 a 12 a 13 a 21 a 22 a 23 a 31 a 32 a 33 {\displaystyle {\begin{array}{|c|c|c|}\hline \!\!\!\;a_{11}\!\!\!&\!\!a_{12}\!\!\!\!\;&\!\!a_{13}\!\!\\\hline \!\!\!\;a_{21}\!\!\!&\!\!a_{22}\!\!\!\!\;&\!\!a_{23}\!\!\\\hline \!\!\!\;a_{31}\!\!\!&\!\!a_{32}\!\!\!\!\;&\!\!a_{33}\!\!\\\hline \end{array}}}
is pandiagonally magic with magic constant s {\displaystyle s} . Adding sums a 11 + a 22 + a 33 , {\displaystyle a_{11}+a_{22}+a_{33},} a 12 + a 22 + a 32 , {\displaystyle a_{12}+a_{22}+a_{32},} and a 13 + a 22 + a 31 {\displaystyle a_{13}+a_{22}+a_{31}} results in 3 s {\displaystyle 3s} . Subtracting a 11 + a 12 + a 13 {\displaystyle a_{11}+a_{12}+a_{13}} and a 31 + a 32 + a 33 , {\displaystyle a_{31}+a_{32}+a_{33},} we get 3 a 22 = s {\displaystyle 3a_{22}=s} However, if we move the third column in front and perform the same argument, we obtain 3 a 21 = s {\displaystyle 3a_{21}=s} . In fact, using the symmetries of 3 × 3 magic squares, all cells must equal 1 3 s {\displaystyle {\tfrac {1}{3}}s} . 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 4 × 4 squares. All 4 × 4 pandiagonal magic squares must be translationally symmetric to the form
… excerpt ends here. Continue reading the full article.

