The magic constant or magic sum of a
magic square
In recreational mathematics, a square array of numbers, usually positive integers, is called a magic square if the sums of the numbers in each row, each column, and both main diagonals are the same. The 'order' of the magic square is the number ...
is the sum of numbers in any row, column, or diagonal of the magic square. For example, the magic square shown below has a magic constant of 15. For a normal magic square of order ''n'' – that is, a magic square which contains the numbers 1, 2, ..., ''n''
2 – the magic constant is
.

For normal magic squares of orders ''n'' = 3, 4, 5, 6, 7, and 8, the magic constants are, respectively: 15, 34, 65, 111, 175, and 260 (sequence
A006003 in the
OEIS
The On-Line Encyclopedia of Integer Sequences (OEIS) is an online database of integer sequences. It was created and maintained by Neil Sloane while researching at AT&T Labs. He transferred the intellectual property and hosting of the OEIS to th ...
).
For example, a normal 8 × 8 square will always equate to 260 for each row, column, or diagonal.
The normal magic constant of order n is (n^3+n)/2.
The largest magic constant of normal magic square which is also a:
*
triangular number
A triangular number or triangle number counts objects arranged in an equilateral triangle. Triangular numbers are a type of figurate number, other examples being square numbers and cube numbers. The th triangular number is the number of dots i ...
is
15 (solve the Diophantine equation x^2=y^3+16y+16, where y is divisible by 4);
*
square number
In mathematics, a square number or perfect square is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, 9 is a square number, since it equals and can be written as .
The u ...
is
1 (solve the Diophantine equation x^2=y^3+4y, where y is even);
*
generalized pentagonal number is 171535 (solve the Diophantine equation x^2=y^3+144y+144, where y is divisible by 12);
*
tetrahedral number is 2925.
Note that 0 and 1 are the only mormal magic constants of rational order which are also rational squares.
However, there are infinitely many rational triangular numbers, rational generalized pentagonal numbers and rational tetrahedral numbers which are also magic const