An arrangement of distinct numbers in a grid, where the numbers in each row, column and main diagonals add up to the same sum, is a peculiar example of ancient mathematics.
2 7 6
9 5 1
4 3 8
(Here the sum is 15.)
The constant that is the sum of every row, column and diagonal is called the magic constant, M. Every normal magic square has a constant dependent on n, calculated by the formula:
M = [n(n2 + 1)] / 2.
For normal magic squares of order n = 3, 4, 5, 6, 7, and 8, the magic constants are, respectively: 15, 34, 65, 111, 175, and 260.
The earliest example is the one of the Lo Shu square (as early as 650 BC) in China. In Albrecht Dürer's magic square the sum 34 can be found in the rows, columns, diagonals, each of the quadrants, the center four squares, and the corner squares.
16 3 2 13
5 10 11 8
9 6 7 12
4 15 14 1
A magic square is also featured on the walls of Sagrada Familia in Barcelona, designed by Gaudi.
In the mid-nineteenth century, an amateur puzzle enthusiast in New York named Palmer Chapman made a physical model of a fourth-order magic square but left out one piece so that the individual cells could slide around. This was known as the 15 Puzzle. In the 1970’s, Erno Rubrik, a Hungarian designer, was attempting to recreate the 15 puzzle in three dimensions when he came up with the Rubik’s Cube.