A
sparse antimagic square (SAM) is a square matrix of size
n by
n of nonnegative integers whose nonzero entries are the consecutive integers 1,\ldots,m for some m\leq n^2, and whose row-sums and column-sums constitute a set of consecutive integers. If the diagonals are included in the set of consecutive integers, the array is known as a
sparse totally anti-magic square (STAM). Note that a STAM is not necessarily a SAM, and vice versa. A filling of the square with the numbers 1 to
n2 in a square, such that the rows, columns, and diagonals all sum to different values has been called a
heterosquare. (Thus, they are the relaxation in which no particular values are required for the row, column, and diagonal sums.) There are no heterosquares of order 2, but heterosquares exist for any order
n ≥ 3: if
n is
odd, filling the square in a
spiral pattern will produce a heterosquare, == See also ==