# Pan-Anti-Magic Squares

The classical definition of an anti-magic square is a square of consecutive numbers that has a different sum for each of its rows, columns, and diagonals. As a further restraint, these sums are also consecutive. My son, Neil, generated a set of anti-magic squares that have additional features. These are the best antagonist to pan-magic squares. The name coined for this new type is pan-anti-magic square. They are pan because the features remain intact when the square is translated and transformed.

A pan-anti-magic square must contain all numbers from 0 to n2-1. They must have pan-sums that can be mapped to a set bounded by the magic constant plus or minus half the set size. The set must have all consecutive numbers skipping the expected magic sum.

 Rows Diagonals {2Compact2} Square 0 1 9 12 22 24 17 14 20 27 21 5 8 2 4 19 43 23 42 28 15 29 14 15 3 6 38 37 44 46 39 33 40 7 10 11 13 41 16 36 18 31 45 32 26 34 25 35

A major difference between traditional anti-magic squares and the pan-anti-magic squares is the skipping of the magic sum. However, in doing only this, it is possible to pan several features as never done before. The lack of the magic sum is required for this type because it causes the set of sums above and below to be equal in size. Further analysis shows that both upper and lower sums are symmetric in every respect. This symmetry can be seen in the following examples.

The first square at right is an order-4 pan-anti-magic square with 32 sums in consecutive order skipping the expected magic constant for order-4 squares. There is only one possible square of this type. The sums range from 14 to 46 skipping the magic constant 30.

 Rows Diagonals {2Compact3} Square 0 6 7 11 24 22 21 20 29 12 13 10 2 37 27 28 38 33 8 3 5 9 25 31 32 15 14 1 4 34 40 39 35 36 23 26
 Rows Diagonals {2Compact3} Square 0 1 14 11 26 21 20 22 27 7 12 10 6 35 28 29 40 31 3 2 5 13 23 32 33 15 9 8 4 36 39 38 25 24 37 34

The next two squares are order-4 pan-anti-magic squares with 20 sums in consecutive order skipping the magic constant expected for order-4 squares. Instead of the anti-{2Compact2} feature, these squares have the anti-{2Compact3} feature, i.e. the corners of all 3x3 squares are included in the groups that add to different sums. The sums range from 20 to 40 skipping the magic constant 30.

Lastly, are 26 squares of order-4 that are pan-anti-magic with no additional features. These all have 16 sums in consecutive order skipping the expected magic constant for order-4 squares. The sums range from 22 to 38 skipping the magic constant 30. These squares were all found by an exhaustive search of all possible order-4 squares.

 Rows Diagonals Square 0 1 14 7 22 31 24 6 10 3 8 27 29 25 2 11 12 13 38 28 35 15 4 5 9 33 32 36 23 26 34 37
 Rows Diagonals Square 0 1 12 9 22 32 27 7 10 4 2 23 24 28 6 3 14 15 38 31 36 13 11 5 8 37 33 29 26 25 35 34
 Rows Diagonals Square 0 1 9 12 22 33 26 7 11 5 2 25 29 27 3 6 14 15 38 24 31 13 10 4 8 35 34 36 23 28 32 37
 Rows Diagonals Square 0 1 11 10 22 35 26 7 13 6 3 29 23 25 5 4 14 15 38 28 37 12 9 2 8 31 34 32 24 27 33 36
 Rows Diagonals Square 0 1 11 10 22 32 23 9 12 8 2 31 26 28 5 4 14 15 38 25 34 13 7 3 6 29 37 35 27 24 36 33
 Rows Diagonals Square 0 2 14 10 26 32 25 7 11 6 3 27 22 28 5 1 13 15 34 31 38 12 9 4 8 33 35 29 24 23 37 36
 Rows Diagonals Square 0 3 13 11 27 29 23 7 9 5 1 22 26 31 4 2 12 15 33 28 34 14 10 6 8 38 37 32 25 24 36 35
 Rows Diagonals Square 0 3 14 9 26 24 25 10 7 4 2 23 28 36 6 1 12 15 34 33 32 13 11 8 5 37 35 27 29 22 38 31
 Rows Diagonals Square 0 3 15 6 24 22 31 9 10 5 12 36 32 23 2 13 11 7 33 37 28 14 8 4 1 27 29 38 25 34 35 26
 Rows Diagonals Square 0 3 13 7 23 22 33 10 9 4 14 37 35 24 1 12 11 5 29 36 25 15 8 6 2 31 27 38 26 32 34 28
 Rows Diagonals Square 0 4 10 9 23 31 27 7 12 1 2 22 24 29 6 5 11 15 37 32 36 13 14 3 8 38 33 28 26 35 25 34
 Rows Diagonals Square 0 4 10 12 26 33 22 7 14 6 2 29 25 27 3 5 11 15 34 24 35 13 9 1 8 31 38 36 23 32 28 37
 Rows Diagonals Square 0 4 6 12 22 35 31 9 13 1 5 28 33 23 3 10 15 8 36 25 29 14 11 2 7 34 27 37 26 38 24 32
 Rows Diagonals Square 0 4 14 9 27 23 25 10 7 3 2 22 28 37 6 1 11 15 33 34 32 13 12 8 5 38 35 26 29 24 36 31
 Rows Diagonals Square 0 5 11 7 23 22 26 12 9 1 2 24 29 38 8 4 10 15 37 35 31 13 14 6 3 36 34 25 33 32 28 27
 Rows Diagonals Square 0 5 14 13 32 25 22 12 10 1 8 31 38 26 9 6 11 2 28 34 37 15 3 7 4 29 23 35 36 24 33 27
 Rows Diagonals Square 0 5 12 7 24 29 25 13 4 1 8 26 37 27 9 11 15 3 38 31 35 14 2 6 10 32 23 33 36 22 34 28
 Rows Diagonals Square 0 6 10 12 28 31 22 7 14 4 2 27 25 29 3 5 9 15 32 26 35 13 11 1 8 33 38 34 23 36 24 37
 Rows Diagonals Square 0 6 10 7 23 26 22 11 13 3 1 28 25 34 8 5 9 15 37 31 35 14 12 2 4 32 38 29 33 36 24 27
 Rows Diagonals Square 0 6 3 15 24 37 25 11 13 7 2 33 35 23 8 4 14 1 27 22 34 12 9 5 10 36 26 38 31 32 29 28
 Rows Diagonals Square 0 6 10 11 27 28 24 13 2 3 4 22 32 25 9 7 12 5 33 31 35 15 8 1 14 38 29 36 37 23 26 34
 Rows Diagonals Square 0 7 3 13 23 36 26 11 12 5 1 29 34 24 8 6 15 2 31 22 32 14 10 4 9 37 28 38 33 35 27 25
 Rows Diagonals Square 0 7 9 13 29 22 33 14 3 4 10 31 35 24 5 6 11 1 23 36 25 15 12 2 8 37 27 38 34 28 26 32
 Rows Diagonals Square 0 8 11 10 29 25 23 9 12 1 2 24 26 35 5 4 7 15 31 32 34 13 14 3 6 36 37 28 27 38 22 33
 Rows Diagonals Square 0 9 7 13 29 24 34 10 3 4 14 31 32 22 12 8 15 2 37 38 28 11 5 1 6 23 26 36 33 25 27 35
 Rows Diagonals Square 0 9 15 12 36 23 32 10 3 6 5 24 31 22 4 8 13 2 27 38 29 11 14 1 7 33 28 37 25 34 35 26