Pandiagonal Magic Squares

Description

In addition to the two main diagonals, each diagonal that wraps around at the edges of the square, sums to the magic constant:

Squares that are pandiagonal and associative are called ultramagic. Two special classes of pandiagonal squares are:

compact
The sum of each 2x2 block, (including wrap-around), is equal to 4/n of the magic constant. See compactk.
complete
The numbers of each complementary pair are distant n/2 on diagonals.

where n is a doubly even order. See note.

Squares that are compact and complete are called most-perfect.

Construction

PandiagonalSquares makes these squares using the methods outlined below. Pandiagonal squares for small orders can be made with MagicRectangles. SODLS also makes pandiagonal and ultramagic squares for some orders.

Order5Special makes the 3600 order 5 pandiagonal magic squares.

Odd Order

Method I

Margossian's "cavalière" method. See under "Types de carrés à ordonnance cavalière" and "Carrés magiques impairs de modules composés" in Margossian. This method is for all odd orders n > 3. Some of the squares are ultramagic. Some, for orders that are a multiple of 3, are compactn/3.

Cavalier Note: Margossian describes the path of successive group numbers as similar to knight moves in the game of chess. In making these squares, the horizontal and vertical steps are not limited to the 1 and 2 cells of the knight move. They may be any appropriate lengths in the range 1-n to n-1, (with wrap-around).

Method II

A method, also attributed to Margossian, given in Rouse Ball. See under "SYMMETRICAL AND PANDIAGONAL SQUARES", page 208. This method is for odd orders n > 3, that are a multiple of 3.

These are all compactn/3. Some are ultramagic.

Method III

The Siamese method. See "Demanding the square is panmagic" in math behind the Siamese method. This method is for odd orders n > 3, that are not a multiple of 3. Some of the squares are ultramagic.

Method IV

From SODLS.
This method is for odd orders n > 3, that are not a multiple of 3. Some of the squares are ultramagic.

Method V

Transpose method.

Examples - multiple of 3

In THE ZEN OF MAGIC SQUARES, CIRCLES, AND STARS, page 255, Clifford Pickover says "Until the 1990s, everyone believed that it was impossible to construct a regular pandiagonal order-9 magic square...".

Actually, these squares were known long before the 1990s. For example, below is one from 1908 and another from 1878.

This is the first of seven given in A.Margossian, DE L'ORDONNANCE DES NOMBRE DANS LES CARRÉS MAGIQUES IMPAIRS, 1908, .txt:

And, this one is given in A.H.Frost, ON THE GENERAL PROPERTIES OF NASIK SQUARES, 1878, .txt:

Note: 72 at row 3, column 6 is corrected to 69.

This order 15 appears in the same article, .txt:

Singly-Even Order

There are no pandiagonal magic squares of singly-even order.
This was shown by A.H. Frost (1878) and C. Planck (1919). See references.

Near-pandiagonal

There are singly-even magic squares in which only four diagonals do not sum to the magic constant.
This is the minimum because:

PandiagonalSquares makes these squares using a process involving three main steps:

  1. Make a semi-magic 4k+2 square that is center symmetric except for the middle 2x2 block, using this process, (similar to Conway's LUX method):

    where, for example, L' is the symmetric complement of L.

    Possible patterns for n = 6, 10, 14, 18 are:

    Orders 6, 14, 22, 30, ... and 10, 18, 26, 34, ... have similar patterns, (differences shown in blue).

  2. Transform this square using Planck's A-D method. This gives a semi-magic square with only four diagonals that do not have the magic sum.
  3. Move 1 or more row(s) and/or column(s) from one side to the opposite side to make the square magic.

Doubly-Even Order

Methods I, II, and III squares are converted to pandiagonal by Planck's A-D method.

Method I

Al_Asfizari associative Method I.

Method II

Al_Asfizari associative Method II.

Method III

C. Planck associative Method III.

Method IV

A method, attributed to Margossian, given in Rouse Ball. See under "SYMMETRICAL AND PANDIAGONAL SQUARES", page 208.

These squares are all most-perfect. Some are bent diagonal. Except for order 4, they are U zigzagn/4.

Method V

Margossian's "cavalière" method. See under "Types de carrés à ordonnance cavalière" and "Note II. - Sur la transformation des groupes naturels de module composé. Application aux modules pairs" in Margossian. See note.

These squares have various levels of compactness, U and V zigzag. Some are complete and some are most-perfect.

Method VI

Transpose method.

There are 48 order 4 pandiagonal magic squares. These are TYPE I in the classification by Dudeney. They are all most-perfect.

Non-prime Odd and Doubly-Even Order

Transpose Method

Dwane Campbell introduced a simple method for square number orders: 4, 9, 16, 25, ..
This method was expanded by Miguel Angel Amela and Hans-Bernhard Meyer to include any non-prime odd or doubly-even order. See Amela example and Meyer example.

All squares made by this method are compactC, where C is the number of columns of the rectangle used in the square's construction.

Pandiagonal Transform

A pandiagonal magic square remains pandiagonally magic if a row or column is moved from one side of the square to the opposite side. So, each order n square makes a total of n2 squares in this way. A near-pandiagonal magic square can be transformed into (n-2)2 near-pandiagonal magic squares in this way, (and 4(n - 1) semi-magic squares).

Pandiagonal 1-Way

In addition to the two main diagonals, all the diagonals, (parallel to only 1 main diagonal), that wrap around at the edges of the square, each add up to the magic constant:

Odd Order

There are 77580 order 5 pandiagonal 1-way magic squares.

Here are order 7 and order 9 pandiagonal 1-way magic squares.

Singly-Even Order

There are no pandiagonal 1-way magic squares of singly-even order. See Planck's proof.

Doubly-Even Order

For doubly-even orders greater than 4, there are pandiagonal 1-way magic squares. Here are order 8, order 12 examples.

Pandiagonal Not Magic

There are squares in which all diagonals have the magic sum but the rows and columns may not. One example of these is made by simply writing the ordered sequence 1 to n2:

These are called natural squares. See Planck. See also reversible squares.

REFERENCES

Ball, W.W.Rouse and H.S.M. Coxeter "MATHEMATICAL RECREATIONS AND ESSAYS, Eleventh Edition"
https://epdf.pub/queue/mathematical-recreations-and-essays-11th-rev-ed.html
, page 208

Candy, Albert L. "Pandiagonal Magic Squares of Prime Order"
http://babel.hathitrust.org/cgi/pt?id=uc1.b4250447;view=1up;seq=7

Candy, Albert L. "Pandiagonal Magic Squares of Composite Order"
http://babel.hathitrust.org/cgi/pt?id=mdp.39015010791260;view=1up;seq=5

Danielsson, Holger "Magic Squares" https://www.magic-squares.info/en.html

Dudeney, Henry E. "Magic Square Problems"
https://archive.org/details/AmusementsInMathematicspdf

Frost, A.H. "ON THE GENERAL PROPERTIES OF NASIK SQUARES"
http://books.google.com/books?id=qxMLAAAAYAAJ&pg=PA34#v=onepage&q&f=false

Heinz, Harvey "Order 4 Magic Squares, Group I ...The pandiagonals"
http://recmath.org/Magic%20Squares/order4list.htm#Group I

Heinz, Harvey "Ultra Magic squares - Walter Trump" http://recmath.org/Magic%20Squares/trump-ultra.htm

Hospel, Ton "The math behind the Siamese method of generating magic squares"
http://www.xs4all.nl/~thospel/siamese.html

Margossian, A. "DE L'ORDONNANCE DES NOMBRE DANS LES CARRÉS MAGIQUES IMPAIRS"
https://archive.org/details/delordonnancede00marggoog

Pickover, Clifford A. "THE ZEN OF MAGIC SQUARES, CIRCLES, AND STARS"
https://epdf.pub/the-zen-of-magic-squares-circles-and-stars-an-exhibition-of-surprising-structure.html

Planck, C. "PANDIAGONAL MAGICS OF ORDERS 6 AND 10 WITH MINIMAL NUMBERS."
http://www.jstor.org/stable/27900742?seq=1#page_scan_tab_contents

Weisstein, Eric W. "Panmagic Square." From MathWorld--A Wolfram Web Resource.
http://mathworld.wolfram.com/PanmagicSquare.html