3
$\begingroup$

Could someone kindly point me to references on constructing magic squares of even order? Does a compact formula/algorithm exist?

  • 0
    I remember, I have seen only of odd order...even ordered exists..?2011-10-27
  • 0
    @Swapan: Yes: there exist magic squares of any order except $2\times 2$. There are many direct algorithms for odd order magic squares, and if you can do a $k\times k$ and an $m\times m$, then you can do the $km\times km$ by dividing it into an $m\times m$ array of $k\times k$ squares (or a $k\times k$ array of $m\times m$ squares), and solving each of them as the $k\times k$, in the order given by the $m\times m$. This deals recursively with any $n$ not congruent to $2$ modulo $4$.2011-10-27
  • 0
    @Arturo, thanks! I read (when I wrote this comment) about the existence from Wikipedia.2011-10-27
  • 0
    @Swapan: I also missed that you need to deal with the $4\times 4$ and the $8\times 8$ directly.2011-10-28
  • 0
    An algorithm for generating even-order magic squares due to Collison is presented [here](http://dx.doi.org/10.1145/368637.368662); if you have MATLAB, you can try to find the file `magic.m` to see the algorithms internally used (discussed briefly [here](http://www.mathworks.com/moler/exm/chapters/magic.pdf)).2011-10-28

2 Answers 2

2

A very elegant method for constructing magic squares of singly even order $n=4m+2$ with $m\geq1$ is due to J. H. Conway, who calls it the "LUX" method. Create an array consisting of $m+1$ rows of Ls, $1$ row of Us, and $m-1$ rows of Xs, all of length $n/2=2m+1$. Interchange the middle U with the L above it. Now generate the magic square of order $2m+1$ using the Siamese method centered on the array of letters (starting in the center square of the top row), but fill each set of four squares surrounding a letter sequentially according to the order prescribed by the letter. That order is illustrated on the left side of the bellow figure, and the completed square is illustrated to the right. The "shapes" of the letters L, U, and X naturally suggest the filling order, hence the name of the algorithm.

This example should illustrate the "LUX" method:

LUX demo

EDIT:

An method for constructing magic squares of doubly even order $n=4m$ is to draw Xs through each $4×4$ subsquare and fill all squares in sequence. Then replace each entry $a_{(ij)}$ on a crossed-off diagonal by $(n^2+1)-a_{(ij)}$ or, equivalently, reverse the order of the crossed-out entries. Thus in the bellow example for $n=8$, the crossed-out numbers are originally $1, 4, ..., 61, 64,$ so entry $1$ is replaced with $64$, $4$ with $61$, etc.

doubly even example

  • 0
    Any idea as to what algorithm exist for constructing doubly-even order magic squares?2011-10-27
  • 0
    @Computist: As Arturo Magidin pointed out in his comment to the question, you can just multiply any 4x4 you know by an (n/4 x n/4) one2011-10-28
  • 3
    @Ross: Of course, this requires you to know how to do a $4\times 4$ and an $8\times 8$ "directly".2011-10-28
  • 4
    [Why is the text strangely familiar...](http://mathworld.wolfram.com/MagicSquare.html)2011-10-28
  • 0
    @J.M,I am suggesting you to change your nickname to "All-seeing eye"2011-10-28
  • 0
    So you're still not going to acknowledge the source of the text of your answer?2011-10-28
  • 0
    @J.M,why ?...you have done it with your comment2011-10-28
  • 1
    @pedja: I use to lend my All-seeing Eye to J.M.2011-10-28
  • 6
    @pedja, that's not enough! you should **always** attribute your sources *before* somebody points it out!2011-10-28
  • 0
    @Gortaur,then..you must be Horus,nice to meet you2011-10-28
  • 0
    @pedja: I totally agree with t.b. and J.M., and it will be nice if you follow the advice in the last comment by t.b. What about Horus, http://en.wikipedia.org/wiki/Sauron - he also has the eye2011-10-28
  • 0
    @Gortaur,http://en.wikipedia.org/wiki/Eye_of_Providence#Religious_use_of_the_Eye2011-10-28
3

This is 2 years old but here are some new results.

A new/revised class of algorithms for single-even/double-even magic squares can be found on arXiv:

http://arxiv.org/ftp/arxiv/papers/1202/1202.0948.pdf