In August 1999 I received the first of several communications from Ralph Fellows detailing work he was doing with transformations. with his permission I present some of his methods on this page.
The ideas are his. However, I have reworded the descriptions and have adapted examples
to order-4 magic squares to conform with the other pages of this section.
In the examples, I use leading 0's for the 1 digit decimal integers to provide easier
formatting.
A period-4 loop |
Add 3 to numbers 1, 5, 9 and 13, subtract 1 from other numbers. |
Base 4 digit swap |
Swap digits of the base 4 representation of the magic square number. |
Complement LSD or MSD |
of the base 4 representation of the magic square number. |
Increment base 4 digits |
to produce a loop of 16 magic squares. |
Intro to Order-4 Transforms. |
Back to the introduction page to this subject. (Also up arrow above and at end). |
Summary |
More transformations and a Table of over 45 order-4 transformations. |
If the number is 1, 5, 9 or 13 then add 3 to the number, else subtract 1 from the number. Example
#93 IV #660 V #467 IV #331 V #93 IV 01 07 14 12 04 06 13 11 03 05 16 10 02 08 15 09 01 07 14 12 16 10 03 05 15 09 02 08 14 12 01 07 13 11 04 06 16 10 03 05 11 13 08 02 10 16 07 01 09 15 06 04 12 14 05 03 11 13 08 02 06 04 09 15 05 03 12 14 08 02 11 13 07 01 10 16 06 04 11 15
There is no group in which this works for all magic squares. Mr. Fellows claims it works for 112 of the 880 order-4 magic squares.
For order-5, add 4 to 1, 6, 11, 15, 21 and subtract 1 from all the other numbers gives
a loop of five.
For order-6, add 5 to 1, 7, 13, 19, 25, 31 and subtract 1 from the other numbers for a
loop of six. Etc.
#238 X A. 0 to 15 B. base 4 C. swap dig. D. base 10 E. #794 X 02 04 13 15 01 03 12 14 01 03 30 32 10 30 03 23 04 12 03 11 05 13 04 12 16 14 01 03 15 13 00 02 33 31 00 02 33 13 00 20 15 07 00 08 16 08 01 09 05 07 12 10 04 06 11 09 10 12 23 21 01 21 32 12 01 09 14 06 02 10 15 07 11 09 08 06 10 08 07 05 22 20 13 11 22 02 31 11 10 08 07 05 11 09 08 06
Shortcut: Instead of working out these 5 steps in turn, the numbers of the original magic square may be converted directly to the following decimal numbers.
original number: 1. 2. 3... 4. 5. 6.. 7.. 8. 9. 10 11 12 13 14 15 16
new number: .....1. 5. 9. 13. 2. 6 10 14. 3.. 7. 11 15.. 4.. 8 12 16
This transformation works for all groups I to VI-P. It also works for some magic
squares of groups VI-S to X, but no magic squares of groups XI or XII.
Sometimes for groups I, II and III the result is a 180 degree rotation of the original
i.e. a self-similar magic square. When the result is a new magic square, it is always a
member of the same group as the original.
This table shows the index number of a magic square in each group that is magic, not magic or a reflection.
Group => | I |
II |
III |
IV |
V |
VI-P |
VI-S |
VII |
VIII |
IX |
X |
XI |
XII |
Magic | all |
all |
all |
all |
all |
all |
71 |
268 |
10 |
118 |
238 |
none |
none |
Not magic | none |
none |
none |
none |
none |
none |
37 |
692 |
40 |
526 |
655 |
all |
all |
rotation or reflection | 116 |
21 |
126 |
? |
? |
? |
? |
? |
? |
? |
? |
none |
none |
Note the similarity of this table to the one for the next two transformations. However,
all 3 transformations generate different magic squares from the same original.
There are 18 groups of four numbers that when converted as per step E above, do not sum to
34. Nine of these sum to 19 and 9 of these sets sum to 49. This also applies to the next 2
transformations, complement LSD and complement MSD of the base 4 number.
There is only one condition to search for when looking for a possible rotation. One of the
two main diagonals must contain the numbers 1, 6, 11 and 16 (in any order). The reason for
this is because the base 4 representation of each of these numbers when they are reduced
by 1 is 00, 11 22 and 33. This results in the line containing the same four numbers when
the digits are reversed.
The digit swap method works for other magic square orders by first converting the magic square to the base for that order.
Complement only the least significant digit of the base 4 numbers.
#126 0 to 15 base 4 comple. LSD back to dec. + 1 = #632 01 08 15 10 00 07 14 09 00 13 32 21 03 10 31 22 03 04 13 10 04 05 14 11 14 11 04 05 13 10 03 04 31 22 03 10 32 21 00 13 14 09 00 07 15 10 01 08 12 13 06 03 11 12 05 02 23 30 11 02 20 33 12 01 08 15 06 01 09 16 07 02 07 02 09 16 06 01 08 15 12 01 20 33 11 02 23 30 05 02 11 12 06 03 12 13
This works for Types I to X.
Types XI and XII have correct rows and columns, but both diagonals are incorrect.
Complement only the most significant digit of the base 4 numbers.
#126 0 to 15 base 4 comple. MSD back to dec. + 1 = #632 01 08 15 10 00 07 14 09 00 13 32 21 30 23 02 11 12 11 02 05 13 12 03 06 14 11 04 05 13 10 03 04 31 22 03 10 01 12 33 20 01 06 15 08 02 07 16 09 12 13 06 03 11 12 05 02 23 30 11 02 13 00 21 32 07 00 09 14 08 01 10 15 07 02 09 16 06 01 08 15 12 01 20 33 22 31 10 03 10 13 04 03 11 14 05 04
Note that this example results in a rotated copy of that obtained from the previous example. However, sometimes the result is a different magic square then that obtained by complementing the LSD. Starting with #303, type VII, #486 was obtained by complementing the LSD and #510 by complementing the MSD.
For a shortcut when working with these two transformations, substituting the new decimal integer directly for the old one bypasses the four intermediate steps.
Original number: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 New number LSD Transform: 4 3 2 1 8 7 6 5 12 11 10 9 16 15 14 13 MSD Transform: 13 14 15 16 9 10 11 12 5 6 7 8 1 2 3 4
Complementing both base 4 digits is the same as complementing the original decimal number.
Group => | I |
II |
III |
IV |
V |
VI-P |
VI-S |
VII |
VIII |
IX |
X |
XI |
XII |
Swap base 4 digits | all |
all |
all |
all |
all |
all |
some |
some |
some |
some |
some |
none |
none |
Complement LSD | all |
all |
all |
all |
all |
all |
some |
some |
some |
some |
some |
none |
none |
Complement MSD | all |
all |
all |
all |
all |
all |
some |
some |
some |
some |
some |
none |
none |
All 3 transformations generate different magic squares from the same original.
In all cases, the new magic square is part of the same group as the original magic square.
This method also works for other magic square orders by first converting the magic square
to the base for that order.
This transformation works by cycling through the base 4 digits, incrementing by 1 (with no carry) then changing back to decimal. This first section illustrates the six steps required for each transition. I use leading 0s in the decimal magic squares simply for formatting.
A B C D E F 104 I -->0-15 Base 4 MSD + 1 Dec 0 to 15 508 IV 01 08 10 15 00 07 09 14 00 13 21 32 10 23 31 02 04 11 13 02 05 12 14 03 14 11 05 04 13 10 14 03 31 22 10 03 01 32 20 13 01 14 08 07 02 15 09 08 07 02 16 09 06 01 15 09 12 01 33 20 22 11 03 30 10 05 03 12 11 06 04 13 12 13 03 06 11 12 02 05 23 30 02 11 33 00 12 21 15 00 06 09 16 01 07 10
I will start a loop of 16 transformations by starting with step C then step F (above).
Loop starts. by incrementing square C (the representation of magic square 104), show the
resulting magic square in decimal using integers 1 to 16, then next increment of the base
4 square, etc.
MSD+0,LSD+1 250 IV MSD+0,LSD+1 473 I MSD+0,LSD+1 669 IV 01 10 22 33 02 05 11 16 02 11 23 00 03 06 12 13 03 12 20 31 04 07 09 14 32 23 11 00 15 12 06 01 33 20 12 01 16 09 07 02 30 21 13 02 13 10 08 03 13 02 30 21 08 03 13 10 10 03 31 22 05 04 14 11 11 00 32 23 06 01 15 12 20 31 03 12 09 14 04 07 21 32 00 13 10 15 01 08 22 33 01 10 11 16 02 05 MSD+1,LSD+0 308 III MSD+0,LSD+1 508 IV MSD+0,LSD+1 632 III 13 22 30 01 08 11 13 02 10 23 31 02 05 12 14 03 11 20 32 03 06 09 15 04 00 31 23 12 01 14 12 07 01 32 20 13 02 15 09 08 02 33 21 10 03 16 10 05 21 10 02 33 10 05 03 16 22 11 03 30 11 06 04 13 23 12 00 31 12 07 01 14 32 03 11 20 15 04 06 09 33 00 12 21 16 01 07 10 30 01 13 22 13 02 08 11 MSD+0,LSD+1 65 IV MSD+1,LSD+0 281 I MSD+0,LSD+1 504 IV 12 21 33 00 07 10 16 01 22 31 03 10 11 14 04 05 23 32 00 11 12 15 01 06 03 30 22 11 04 13 11 06 13 00 32 21 08 01 15 10 10 01 33 22 05 02 16 11 20 13 01 32 09 08 02 15 30 23 11 02 13 12 06 03 31 02 12 03 14 09 07 04 31 02 10 23 14 03 05 12 01 12 20 33 02 07 09 16 02 13 21 30 03 08 10 13 MSD+0,LSD+1 623 I MSD+0,LSD+1 60 IV MSD+1,LSD+0 478 III 20 33 01 12 09 16 02 07 21 30 02 13 10 13 03 08 31 00 12 23 14 01 07 12 11 02 30 23 06 03 13 12 12 03 31 20 07 04 14 09 22 13 01 30 11 08 02 13 32 21 13 00 15 10 08 01 33 22 10 01 16 11 05 02 03 32 20 11 04 15 09 06 03 10 22 31 04 05 11 14 00 11 23 32 01 06 12 15 10 21 33 02 05 10 16 03 MSD+0,LSD+1 682 IV MSD+0,LSD+1 126 III MSD+0,LSD+1 274 IV 32 01 13 20 15 02 08 09 33 02 10 21 16 03 05 10 30 03 11 22 13 04 06 11 23 10 02 31 12 05 03 14 20 11 03 32 09 06 04 15 21 12 00 33 10 07 01 16 00 33 21 12 01 16 10 07 01 30 22 13 02 13 11 08 02 31 23 10 03 14 12 05 11 22 30 03 06 11 13 04 12 23 31 00 07 12 14 01 13 20 32 01 08 09 15 02
The next iteration would be MSD +1, LSD+0, which would give us square C in the example
above. This square represents #104, group I, which is the magic square we started with.
Notice that there are 4 group I and 4 group III, but 8 group IV. It would seem that this
works out correctly because there are 48 magic squares of groups I and III but 96 magic
squares of group IV.
However, when I worked out another loop (starting with # 109), it contained 4 group I, 4
group IV, 4 group V and 4 group VI-P. Also, this method does not work for many magic
squares (including group I - 102, 116, and 279).
Please send me Feedback about my Web
site!
Last updated
September 09, 2003
Harvey Heinz harveyheinz@shaw.ca
Copyright © 2000 by Harvey D. Heinz