Magic Square
In recreational mathematics, a magic square is a n x n square grid (where n is the number of cells on each side) filled with distinct positive integers in the range 1,2,...,n² such that each cell contains a different integer and the sum of the integers in each row, column and diagonal is equal. The sum is called the magic constant or magic sum of the magic square. A square grid with n cells on each side is said to have order n.
In regard to magic sum, the problem of magic squares only requires the sum of each row, column and diagonal to be equal, it does not require the sum to be a particular value. Thus, although magic squares may contain negative integers, they are just variations by adding or multiplying a negative number to every positive integer in the original square.
Magic squares are also called normal magic squares, in the sense that there are non-normal magic squares which integers are not restricted in 1,2,...,n². However, in some places, "magic squares" is used as a general term to cover both the normal and non-normal ones, especially when non-normal ones are under discussion. Moreover, the term "magic squares" is sometimes also used to refer to various types of word squares.
Magic squares have a long history, dating back to at least 650 BC in China. At various times they have acquired magical or mythical significance, and have appeared as symbols in works of art. In modern times they have been generalized a number of ways, including using extra or different constraints, multiplying instead of adding cells, using alternate shapes or more than two dimensions, and replacing numbers with shapes and addition with geometric operations.