# The Anti-Magic Square Project: Structure

## The Entries

Usually when people talk about making a Magic Square, they mean using the numbers 1 to n2 to fill in the entries. But, most of the time on this site you'll see squares filled with the numbers 0 to n2-1. This can make things more convenient, especially for one of the constructions. If you don't like this, you can always just add one to every entry and the square will still be [Anti] Magic.

## Positive and Negative Squares

The definition of an AMS only requires the sums to be consecutive integers -- it doesn't say anything about which consecutive integers. It turns out, however, that for a given order, there are only two possibilities for the range of achievable sums. It also turns out that the diagonal sums are special. The following proof of these facts is due to Sheng Jiang and Rui-Chen Chen (Yangzhou University, China): ``` ```

### `Classification Theorem:`

``` Suppose an AMS(n) exists. Let c be the Magic Constant, where c = 1/2*n(n2+1) Every AMS(n) is either: Positive, with sums: smin ... smax where smin = c - n ; smax = c + n + 1 Negative, with sums: smin ... smax where smin = c - n - 1; smax = c + n Proof: Let ri, ci, di denote the ith row, column, and diagonal sum respectively. We will find the sum: S = (r1 + ... + rn) + (c1 + ... + cn) + (d1 + d2) in two different ways. We know that (r1 + ... + rn) and (c1 + ... + cn) are both just the sum of all the elements in the square, which is nc. So S = 2nc + (d1 + d2) But S is also the sum of the consecutive integers smin ... smax. So S = (n + 1)(2smin + 2n + 1) If we set these expressions equal to each other, we have: (d1 + d2) = (n + 1)(2smin + 2n + 1) - 2nc Clearly, the diagonals are greater than the two smallest sums and less than the two largest sums, or: (smin) + (smin + 1) <= (d1 + d2) <= (smin + 2n) + (smin + 2n + 1) Substituting our expression for (d1 + d2) and simplifying we get: c - n - 3/2 <= smin <= c - n + 1/2 Since we're only working with integers, either smin = c - n or smin = c - n - 1 ```

```Q.E.D. ```

## Symmetry

If you have an Anti-Magic square, there are some simple operations you can perform on it to get a different, related square. The most obvious operation is to rotate it 90, 180, or 270 degrees. Or, we could flip the square along some axis. It should be clear that since we haven't disturbed the ordering of the elements in relation to themselves, the sums will be unchanged and our square will still have it's [Anti]-Magic properties. These kind of operations form a group of symmetries which we can exploit when enumerating all squares of a given order.

Composed by John Cormie Updated: March 19, 2000