### Shift method

Excluding rotating and/or mirroring there are 275.305.224 (x 8 = including  2.202.441.792) pure magic 5x5 squares, 3.600 (x 8 = 28.800) are also panmagic (see for example on website www.gaspalou.fr/magic-squares/order-5.htm and of the 3.600 panmagic squares 16 are panmagic and symmetric (= ultra magic); see on website http://mathsforeurope.digibel.be/magic.htm.

To construct a 5x5 panmagic square fill in the first row of the first grid with all the numbers from 0 up to 4, first 0 and than 1 up to 4 in random order. There are 24 combinations: 01234, 01243, 01324, 01342, 01423, 01432, 02134, 02143, 02314, 02341, 02413, 02431, 03124, 03142, 03214, 03241, 03412, 03421, 04123, 04132, 04213, 04232, 04312, 04321.

Construct row two up to five by shifting the first row each time 2 places to the left.

First grid

 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4

Fill in the first row of the second grid (take for example the first row of the first grid).

Construct row two up to five by shifting the first row each time 2 places to the right.

Second grid

 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4

Take 5x number from the first grid and add 1x number from the same cell of the second grid. Finally add 1 to each cell.

5x number           1x number           =  +1                               =   panmagic 5x5

 0 1 2 3 4 0 1 2 3 4 0 6 12 18 24 1 7 13 19 25 2 3 4 0 1 3 4 0 1 2 13 19 20 1 7 14 20 21 2 8 4 0 1 2 3 1 2 3 4 0 21 2 8 14 15 22 3 9 15 16 1 2 3 4 0 4 0 1 2 3 9 10 16 22 3 10 11 17 23 4 3 4 0 1 2 2 3 4 0 1 17 23 4 5 11 18 24 5 6 12

Construct the first grid with the 24 given combinations. Construct the second grid with the following 6 combinations 01234, 01243, 01324, 01342, 01423 or 01432. So you can make 24 x 6 (combinations) x 25 (shifting the magic square on a 2x2 carpet) x 8 (by rotating and/or mirroring) is all 28.800 panmagic 5x5 squares.

On website www.grogono.com/magic/5x5.php you find the 144 basic 5x5 panmagic squares. By shifting on a 2x2 carpet and by rotating and/or mirroring you can make all 144 x 25 x 8 = 28.800 panmagic 5x5 squares.

See on webpage www.grogono.com/magic/5x5pan144.php that the above mentioned 5x5 panmagic square is basic square number 2.

The 36 essential different panmagic 5x5 squares

See on webpage www.magic-squares.net/pandiag5.htm that you can reduce the 5x5 panmagic squares to 36 essential different squares by swapping the sequence of rows and columns in 1-3-5-2-4 and/or swapping pandiagonals into rows (see example below).

 1 7 13 19 25 1 1 20 9 23 12 14 20 21 2 8 2 8 22 11 5 19 22 3 9 15 16 3 15 4 18 7 21 10 11 17 23 4 4 17 6 25 14 3 18 24 5 6 12 5 24 13 2 16 10

Use the shift method to construct magic squares of odd order from 5x5 to infinite.

See

5x5, shift method.xls