Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

A puzzle related to magic squares: grids of integers where all rows, columns, and diagonals have the same sum.

A magic square is an arrangement of distinct numbers (i.e. each number is used only once), usually integers, in a square grid, where the numbers in each row, and in each column, and the numbers in the main and secondary diagonals, all add up to the same number. An $n\times n$ magic square that contains the integers from 1 to $n^2$ is called a normal magic square.

Example: Up to rotations and reflections, there is only one $3\times 3$ magic square with entries 1,2,...,9 (which is also known under its Chinese name "Lo Shu"):

   8  1  6   
   3  5  7  
   4  9  2  
history | excerpt history