Legend says the flood came first. Some four thousand years ago, as the story goes, Emperor Yu of China stood by the River Lo as the waters receded, and a turtle crawled from the river bearing a strange pattern of dots on its shell. Read as a three-by-three grid of the numbers 1 to 9, the pattern had an uncanny property: every row, every column and both diagonals summed to 15. The Lo Shu square was taken as a message from heaven and woven into Chinese cosmology, divination and feng shui. The legend places it around 2000 BC; the earliest surviving written references are far later, from roughly the fourth century BC. Either way it stands as humanity's first recorded magic square — and essentially its only one of that size, for every 3×3 magic square of the digits 1 to 9 is the Lo Shu rotated or reflected.
The rules generalise beautifully. A magic square of order n arranges the numbers 1 to n² so that every row, column and main diagonal shares one total — the magic constant, which works out to n(n²+1)/2. That gives 15 for order 3, then 34, 65 and, for the chessboard-sized order 8, exactly 260. And the scarcity vanishes fast: order 3 offers a single essential square, but Bernard Frénicle de Bessy counted exactly 880 essentially different squares of order 4 in work published in 1693, and order 5 balloons to 275,305,224 — a figure only pinned down by computer in 1973.
From talisman to masterpiece
Magic squares travelled west with trade and scholarship. Arab mathematicians were constructing them systematically by the tenth century, called them wafq, and wore them as talismans against illness and misfortune. Renaissance occultists inherited the habit: Cornelius Agrippa's sixteenth-century De occulta philosophia assigned squares of orders three to nine to the seven known planets, from Saturn out to the Moon. In India, meanwhile, the Parshvanatha temple at Khajuraho bears a celebrated 4×4 square, roughly a thousand years old, whose constant of 34 holds even along the "broken" diagonals — a stronger condition mathematicians now call pandiagonal.
Europe's most famous specimen hides inside a masterpiece. Albrecht Dürer's brooding engraving Melencolia I contains a 4×4 magic square in which the rows, columns, diagonals, the four quadrants, the four corners and the centre block all give 34 — and the two middle cells of the bottom row read 15 and 14, the date of the work: 1514. Two centuries on, Benjamin Franklin amused himself constructing prodigious 8×8 and 16×16 squares laced with hidden patterns, describing the larger as "the most magically magical of any magic square ever made by any magician" — though purists note that his main diagonals fail, making his creations, strictly, only semi-magic. The tradition never died: the Passion façade of Barcelona's Sagrada Família carries a square by the sculptor Josep Subirachs that sums to 33, the traditional age of Christ at the crucifixion — but only by repeating two numbers and omitting two others, so it is no true magic square at all.
The knight joins the game
The chessboard, meanwhile, had bred its own numerical obsession: the knight's tour, in which a knight must visit all 64 squares exactly once. Solutions were known to al-Adli, a ninth-century master writing in Baghdad, and in 1759 Leonhard Euler gave the puzzle its first systematic mathematical treatment — the moment the tour passed from parlour trick into mathematics.
It was only a matter of time before someone married the two puzzles. Number the squares 1 to 64 in the order the knight visits them: if every row and column of the resulting array sums to 260, you have a magic knight's tour. The first such tour was published by William Beverley in 1848. Whether a fully magic tour — diagonals included — could exist on the standard board remained open for a century and a half, until 2003, when an exhaustive computer search led by Guenter Stertenbrink settled it. The verdict: exactly 140 distinct semi-magic knight's tours exist on the 8×8 board, and not one of them is fully magic.
Four thousand years separate the turtle's shell from the server farm, and the spell has not weakened. A magic square offers what mathematics always promises but rarely displays so plainly: disorder on the surface and, underneath, everything in perfect balance.
Quiz nuggets
- The Lo Shu, the legendary 3×3 magic square said to have appeared on a turtle's shell from China's River Lo, has a magic constant of 15.
- Albrecht Dürer's 1514 engraving Melencolia I contains a 4×4 magic square whose bottom row includes the cells 15 and 14 — the date of the work.
- Bernard Frénicle de Bessy established that there are exactly 880 essentially different 4×4 magic squares, published in 1693.
- Leonhard Euler's 1759 paper gave the knight's tour its first systematic mathematical analysis.
- A 2003 computer search proved that no fully magic knight's tour exists on the 8×8 chessboard — only 140 semi-magic ones.