Reference articles on history, science, culture and more
Encyclopedia

Conway's LUX method for magic squares

Algorithm for creating magic squares

Conway's LUX method for magic squares is an algorithm by John Horton Conway for creating magic squares of order 4n+2, where n is a natural number.

01Method

Start by creating a (2n+1)-by-(2n+1) square array consisting of

  • n+1 rows of Ls,
  • 1 row of Us, and
  • n-1 rows of Xs,

and then exchange the U in the middle with the L above it.

Each letter represents a 2x2 block of numbers in the finished square.

Now replace each letter by four consecutive numbers, starting with 1, 2, 3, 4 in the centre square of the top row, and moving from block to block in the manner of the Siamese method: move up and right, wrapping around the edges, and move down whenever you are obstructed. Fill each 2x2 block according to the order prescribed by the letter:

\mathrm {L} :\quad {\begin{smallmatrix}4&&1\\&\swarrow &\\2&\rightarrow &3\end{smallmatrix}}\qquad \mathrm {U} :\quad {\begin{smallmatrix}1&&4\\\downarrow &&\uparrow \\2&\rightarrow &3\end{smallmatrix}}\qquad \mathrm {X} :\quad {\begin{smallmatrix}1&&4\\&\searrow \!\!\!\!\!\!\nearrow &\\3&&2\end{smallmatrix}}

02Example

Let n = 2, so that the array is 5x5 and the final square is 10x10.

LLLLL
LLLLL
LLULL
UULUU
XXXXX

Start with the L in the middle of the top row, move to the 4th X in the bottom row, then to the U at the end of the 4th row, then the L at the beginning of the 3rd row, etc.

68 65 96 93 4 1 32 29 60 57
666794952330315859
92892017282556536461
90911819262754556263
16132421495280778885
14152223505178798687
3740454876738184912
38394647747582831011
4144697297100583336
434271709998763534
Watch videos about Conway's LUX method for magic squaresExplainers and documentaries on YouTube (opens in a new tab)

Sources and credits

This article is adapted from the Wikipedia article Conway's LUX method for magic squares, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.

Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.