This site is supported by donations to The OEIS Foundation.

# Magic squares

A magic square is a square arrangement of numbers in which each row, column and diagonal adds up to the same value (called the magic constant). Usually, the magic square has the numbers
 1
to
 n 2
(such squares are called normal). One of the best known magic squares has
 n = 3
and magic constant
 15
:

 9 1 5 3 4 8 6 7 2

## Magic constant

The magic constant of an
 n  ×  n
magic square with numbers
 1
to
 n 2
is
${\displaystyle {\frac {T_{n^{2}}}{n}}={\frac {n^{2}(n^{2}+1)}{2n}}={\frac {n(n^{2}+1)}{2}},}$ (A006003)
where
 Tk
is the k-th triangular number.