Monday, July 23, 2007

MS15. MAGIC SQUARES

Magic Squares - Singly even order - new method. ALSO VISIT http://pranadit.wordpress.com

While it is very easy to construct odd order magic squares (the Hindu Rule is a very easy method for an nxn square where "n" is odd) and doubly even order magic squares, singly even order squares are not that easy. Border square method is the one most commonly used. I have developed a method for construction of (n+4) x (n+4) squares from nxn square where n is 6,10,14,18......to easily give multiple solutions without much effort.
I will illustrate my method by first constructing a 14x14 square assuming that we have a 10x10 square. The 10x10 square will occupy the center place. 14x14 square has numbers from 1 to 196 and 10x10 square numbers from 1 to 100. If we take half the difference between 196 and 100 we get 48 and if we add this to all numbers in our 10x10 square we will have a 10x10 square with numbers from 49 to 148 and total of 505 + 10x48 = 985. The 14x14`square needs to have a total of 1379, this leaves us with a difference of 394. The numbers from 1 to 48 and 149 to 196 can be used to form six 4x4 squares with numbers from i) 1 to 8 & 189 to 196, ii) 9 to 16 and 181 to 188, iii) 17 to 24 and 173 to 180, iv) 25 to 32 and 165 to 172, v) 33 to 40 and 157 to 164, and vi) 41 to 48 and 149 to 156, to give a total of 394 for all the six 4x4 squares. We will label 5 from these 6 squares from 1 to 5 and, the 10x10 square by 0, the sixth square will need to be split into two 4x2 square and has been labeled from A to P to fit our requirements of 14x14 square.

1 1 2 2 3 3 A B 3 3 2 2 1 1
1 1 2 2 3 3 C D 3 3 2 2 1 1
4 4 0 0 0 0 0 0 0 0 0 0 4 4
4 4 0 0 0 0 0 0 0 0 0 0 4 4
5 5 0 0 0 0 0 0 0 0 0 0 5 5
5 5 0 0 0 0 0 0 0 0 0 0 5 5
I K 0 0 0 0 0 0 0 0 0 0 M O
J L 0 0 0 0 0 0 0 0 0 0 N P
5 5 0 0 0 0 0 0 0 0 0 0 5 5
5 5 0 0 0 0 0 0 0 0 0 0 5 5
4 4 0 0 0 0 0 0 0 0 0 0 4 4
4 4 0 0 0 0 0 0 0 0 0 0 4 4
1 1 2 2 3 3 E F 3 3 2 2 1 1
1 1 2 2 3 3 G H 3 3 2 2 1 1

We can select any one of the six squares by turns for 1 to 5, the remaining sixth 4x4 square has to be formed slightly differently as already explained. We have to ensure that A + B = C + D = E + F = G + H = I + J = K + L = M + N = O + P = 197 and A + C + E + G = B + D + F + H = I + K + M + O = J + L + N + P = 394.
Since the 10x10 square occupies the center place the and that leaves us only two top rows and two bottom rows, and similarly two L.H.S. and R.H.S. columns, the five 4x4 squares have been split into two 4x2 squares and suitably placed in the corners. The 1 square will take care of our Diagonal totals for the 14x14 square, so we don't have to worry about diagonal totals in rest of the 4x4 squares which means having selected the 4x4 square from the available 712 squares (880 less the squares which have 3 numbers<9 and 1<8, or 3 numbers>8 and 1<9) we can switch its rows and columns giving 4!x4! i.e. 576 solutions for each of the 4 squares. As regards four 2x2 squares we are again free to switch A & B, C & D, E & F, G & H, in pairs and similarly the I & J, K & L, M & N, O & P, thus giving 576 solutions for each of them. In addition we can replace X's by Y's, doubling the number of solutions, from the square as it stands. And, of course, selection of 4x4 squares i.e., A,B,....can be done in 6! ways.
(P.S. simplest way to form the 4x4 square, say with numbers from 17 to 24 and 173 to 180, would be to add in an ordinary 4x4 square 16 to all numbers from 1 to 8 and 164 to all numbers from 9 to 16.)
When we go from 14x14 to 18x18 square, the base becomes 14x14 square and to all the numbers we add 1/2(18x18 - 14x14)=64 and the 14x14 square total becomes 2275. The total required for 18x18 square is 2925, this is less by 650 to be filled by the empty cells. We have now numbers from 1 - 64 and 261 - 324 to form 8 4x4 squares with each having a total of 650. Of these one will be required for extreme corners (like 1) and one for splitting into two 4x2 squares. From rest 6 we will have 3 squares for rows and 3 squares for columns, and the number of multiple squares that can be generated from this one 18x18 squares can easily be worked out.
I will now come to the first square that can be formed, i.e. the 6x6 square. I will prepare the ground by using one of the 880 4x4 squares, but for those not fully conversant, I give the basic square using alphabets and where Aa stands for A+a.
Aa Bb Cc Dd
Dc Cd Ba Ab
Bd Ac Db Ca
Cb Da Ad bc

Here A's can be given one of the values from 1,2,3,4 and a's can be given one of the values from 0,4,8,12. But each value can be given only once, i.e. if you give 1 to A you can give B only from 2,3,4 and so on. Alternately you can give to A's from 0,4,8,12 and a's from 1,2,3,4. After constructing the 4x4 square simply add 10 to all numbers. 10 is 1/2(36-16), this will take the sum in each row, column and diagonal to 74. Numbers now available to us are 1 to 10 and 27 to 36. Next I construct a 2x2 square such that its diagonals total 37.
2 & 35 and 1 & 36.
This enables me to take care of the diagonal totals as I am going to break up the 4x4 square into four 2x2 squares and place them in the corners. For my 4x4 square I give value 1 to a, 2 to b, 3 to c, and 4 to d, 0 to A, 4 to B, 8 to C and 12 to D. So my 6x6 square now looks like this:
11 16 00 00 21 26
25 22 00 00 15 12
00 00 02 36 00 00
00 00 01 35 00 00
18 23 00 00 24 19
20 23 00 00 14 17
(Here 00 stand for values yet to be filled in.)
Next I insert numbers, from those available, in columns 3 and 4 in rows 1,2,5 and 6 such that sum of numbers in each row is 37. Next I place numbers in rows 3 and 4 in columns1, 2, 5 and 6 such that magic sum of that each column total is 37. This ensures that the magic sum of 111 is available for each row, column and 2 main diagonals. My final 6x6 square is:
11 16 34 03 21 26
25 22 33 04 15 12
09 29 02 36 05 30
28 08 01 35 32 07
18 13 10 27 24 19
20 23 31 06 14 17
( 1 has been written as 01, 2 as 02, etc..)

Even if we ignore choices for the central 2x2 square, we can from this one square alone
generate very large number of 6x6 squares. We have choice of 880 for the4x4 squares
and they can be rotated to give 4 times more squares. Next the numbers in columns 3
and 4 in the rows 1, 2, 5 and 6 can be interchanged and so can the numbers in rows 3
and 4 in columns 1, 2, 5, and 6. Also numbers in column 3 and 4 can be interchanged as
also numbers in row 3 with numbers in row 4.
To make my point clear I am replacing numbers in column 3 and 4 in rows 1,2,5 and 6 by
alphabets and also in rows 3 and 4 in columns 1, 2, 5, and 6.
00 00 A1 B1 00 00
00 00 A2 B2 00 00
C1 C2 00 00 C3 C4
D1 D2 00 00 D3 D4
00 00 A3 B3 00 00
00 00 A4 B4 00 00
(Here again 00 have been placed in the empty spaces to suit the format design.)

Here A1+B1=A2+B2=A3+B3=A4+B4=37, and C1+D1= C2+D2=C3+D3=C4+D4= 37
And so are interchangeable. So we have at least 880x4x24x24x2x2x2 squares!
Let us now go to construction of 10x10 square. First we add 32 equal to 1/2(100 -36) to
all numbers in one of the 6x6 square available to me. This will give me a total of
111+32x6=303 for the 6x6 square. Next I construct four 4x4 squares from the numbers
1 to 32 and 69 to 100 available to me by adding i) 0 to all numbers < 9 and 84 to all
numbers >8, ii) 8 to all numbers <9 and 76 to all numbers >8, iii) 16 to all numbers <9
and 68 to all numbers >8 and iv) 24 to all numbers <9 and 60 to all numbers>8, limiting
our choice to 712 4x4 squares, excluding those which may have 3 numbers < 9 and 3
numbers > 8. To go from 10x10 to 14x14, place 10x10 square in the centre increasing all
numbers by 1/2(196 100),i.e.48, to give a total of 985 for the 10x10 square, the 4x4
squares will give 394 making a total of 1,379, as required, for the 14x14 square. The 4x4
squares will number 5 and there will be 2 4x2 squares and placed just as in 10x10 square
when we proceeded from 6x6 square to 10x10square.
Similar procedures will follow from 14x14 to 18x18 etc. as clarified above. Try to form
The 10x10 square and if you have difficulty get in touch with me by email
bdtara@yahoo.com

No comments: