I then confessed to him that in my younger days, having once some leisure which I still think I might have employed more usefully, I had amused myself in making these kind of magic squares...
A magic square (of order n) is an nxn array such that each number between 1 and n2 occurs precisely once, and all row sums and column sums are equal.
Magic squares are easy to construct, and one usually tries to impose additional restrictions. For example, it is common to ask that the sum of the numbers along a diagonal also equals the row sum.
Franklin claims other restrictions for his squares, namely that the sum of the numbers along the first or second half of each row or column is half the row sum. Also that the sum of the numbers along a "bent row" (half of the main diagonal together with half of the back diagonal) equals the row sum.
Example quoted from the above web site:
52 61 4 13 20 29 36 45 14 3 62 51 46 35 30 19 53 60 5 12 21 28 37 44 11 6 59 54 43 38 27 22 55 58 7 10 23 26 39 42 9 8 57 56 41 40 25 24 50 63 2 15 18 31 34 47 16 1 64 49 48 33 32 17with "bent row" patterns
# - - - - - - - # - - - - - - # - # - - - - - - - # - - - - # - - - # - - - - - - - # - - # - - - - - # - - - - - - - # # - - - - - - # - - - - - - - - - - - - - - # - - - - - - - - - - - - - - # - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - # - - - - - - - - - - - - - - # - - - - - - - - - - - - - - # - - - - - - # # - - - - - - - # - - - - - # - - # - - - - - - - # - - - # - - - - # - - - - - - - # - # - - - - - - # - - - - - - - #
From this 2x2 subsquare property many other properties follow immediately. For example, one sees that a horizontally adjacent pair of cells in row i and columns j and j+1 gives a sum that depends only on j and on the parity of i, so that two such pairs in the same columns and on rows with an even distance have the same sum.
And from that it follows again that the bent rows need not have their halves along the diagonals: translations will work just as well.
Note that a magic square with the 2x2 subsquare property necessarily has even order, so we may assume that n is even.
Since cyclically permuting rows and columns does not change the requirements for a magic square of even order with 2x2 subsquare property, we may assume that the number 1 is in the top left corner.
(Concerning permutations: all permutations of rows and columns can be used provided that they respect the parity of row or column number.)
Let Sij be the number in row i and column j. Put aj = S1j and bi = Si1 so that a1 = b1 = 1. Now all Sij can be expressed in terms of the aj and bi.
Let M=n2+1. In order to get slightly simpler expressions (avoiding factors (−1)i) put cj = aj if j is odd, and cj = M−aj if j is even, and similarly di = bi if i is odd, and di = M−bi if i is even. (So that c1 = d1 = 1.) Now the expression for Sij becomes Sij = M+1−cj−di if i+j is odd, and Sij = cj+di−1 if i+j is even. (Check that this correctly gives the first row and the first column, and has 2x2 subsquares summing to 2M.)
The numbers cj and di cannot be chosen arbitrarily: we must make sure that the Sij are all distinct numbers in 1, ..., n2.
Assume the additional restriction di = dn+1−i. We have to make sure that the n2/2 numbers cj+di−1 (j=1,...,n and i=1,...,n/2) pick one of the two numbers x and M−x for x=1,...,n2/2.
Assume that all numbers di are equal mod n. (Then they are all 1 mod n.) Assume that the n numbers cj are distinct mod n, and that the n/2 numbers di are distinct. Then the value of cj+di−1 mod n determines j and we see that these n2/2 numbers are all distinct. Clearly, they are all larger than or equal to 1. In order to make sure that cj+di−1 is never larger than n2, assume that the cj are the numbers 1,...,n. Finally, in order to make sure that no two numbers add up to M it suffices that no two (di−1)/n add up to n−1.
These are very light restrictions, so we easily find squares of order n with the 2x2 subsquare property for all even n. Note however that there is no guarantee yet that all row sums will be equal. (But the column sums will, due to the symmetry in the di.)
Example For n=2 the above yields the square
1 3 4 2which does not have equal row sums. (And, clearly, there is no 2x2 magic square.)
Example For n=4 the above yields the square
1 15 4 14 8 10 5 11 9 7 12 6 16 2 13 3that achieves constant row and column sums, but no uniform half row and half column sums. (Here we had c1 = 1, c2 = 2, c3 = 4, c4 = 3, d1 = 1, d2 = 9. The condition to fulfil for constant row sums was c1+c3 = c2+c4.)
Example For n=12 one can write down the magic square
1 142 6 138 8 140 2 141 10 136 12 134 132 15 127 19 125 17 131 16 123 21 121 23 97 46 102 42 104 44 98 45 106 40 108 38 36 111 31 115 29 113 35 112 27 117 25 119 73 70 78 66 80 68 74 69 82 64 84 62 96 51 91 55 89 53 95 52 87 57 85 59 49 94 54 90 56 92 50 93 58 88 60 86 72 75 67 79 65 77 71 76 63 81 61 83 109 34 114 30 116 32 110 33 118 28 120 26 48 99 43 103 41 101 47 100 39 105 37 107 13 130 18 126 20 128 14 129 22 124 24 122 144 3 139 7 137 5 143 4 135 9 133 11with constant row and column sums 870, and constant half row and half column sums 435, but not all "bent rows" have the same sum 870.
1 142 11 136 8 138 5 139 12 135 2 141 120 27 110 33 113 31 116 30 109 34 119 28 121 22 131 16 128 18 125 19 132 15 122 21 48 99 38 105 41 103 44 102 37 106 47 100 73 70 83 64 80 66 77 67 84 63 74 69 60 87 50 93 53 91 56 90 49 94 59 88 85 58 95 52 92 54 89 55 96 51 86 57 72 75 62 81 65 79 68 78 61 82 71 76 97 46 107 40 104 42 101 43 108 39 98 45 24 123 14 129 17 127 20 126 13 130 23 124 25 118 35 112 32 114 29 115 36 111 26 117 144 3 134 9 137 7 140 6 133 10 143 4with constant row and column sums 870, no constant half row and half column sums, but with constant third row and third column sums, and good "bent rows" and good diagonals.
A magic square of order 12 with constant half row and half column sums and also constant "bent row" sums seems missing so far.
Added 2007-05-16:
Cor Hurkens verified by computer that such a square of order 12
does not exist, and continued to produce a nice example of
order 16.