# Heterosquare

A heterosquare of order n is an arrangement of the integers 1 to n2 in a square, such that the rows, columns, and diagonals all sum to different values. In contrast, magic squares have all these sums equal.

There are no heterosquares of order 2, but heterosquares exist for any order n ≥ 3.

## Examples

2 1 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 32 33 34 35 36
Order 3 Order 4 Order 5 Order 6

## Properties

Heterosquares are easily constructed, as shown in the above examples. If n is odd, filling the square in a spiral pattern will produce a heterosquare.[1] And if n is even, a heterosquare results from writing the numbers 1 to n2 in order, then exchanging 1 and 2.

It is suspected that there are exactly 3120 essentially different heterosquares of order 3.[2]

An antimagic square is a special kind of heterosquare where the 2n + 2 row, column and diagonal sums are consecutive integers.

## References

1. ^ Weisstein, Eric W. "Heterosquare". MathWorld.
2. ^ Peter Bartsch's Heterosquares at magic-squares.net