[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | Mathematics at DEC |
|
Moderator: | RUSURE::EDP |
|
Created: | Mon Feb 03 1986 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 2083 |
Total number of notes: | 14613 |
526.0. "Magic squares" by VOGON::CATTERMOUL (Richard REO F/M8 830-4564) Fri Jun 27 1986 11:30
Using a few simple rules, it is possible to build up magic squares
8x8, 16x16 etc using the basic 4x4 magic square.
The smallest even number magic square is the 4x4:
9 12 6 7
8 5 11 10
15 14 4 1
2 3 13 16
As you can see, it uses the numbers 1 to 16, The sums across, down
and diagonally = 34 = (1 + 16)*2.
To construct an 8x8 using the numbers 1 to 64, our magic sum =
(1+64)*2 = 130.
Construct four 4x4 squares by adding 16 successively to each number in
the 1st square (the above one), and then 16 to the numbers in the 2nd
square and so on. Thus you get:
9 12 6 7 25 28 22 23
8 5 11 10 24 21 27 26
15 14 4 1 31 30 20 17
2 3 13 16 18 19 29 32
41 44 38 39 57 60 54 55
40 37 43 42 56 53 59 58
47 46 36 33 63 62 52 49
34 35 45 48 50 51 61 64
Divide each square into 4 quadrants. Take each of the 16 numbers from the
top left hand quadrants of the four squares and position them in a 4x4
square according to the order of the numbers in the basic 4x4. i.e. take
the numbers
5, 8, 9, 12, 21, 24, 25, 28, 37, 40, 41, 44, 53, 56, 57, 60.
position: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Therefore, 5 goes in position 1, 8 goes in position 2, 9 goes in position 3
etc. 60 goes in position 16. The result is:
37 44 24 25
28 21 41 40
57 56 12 5
8 9 53 60
Do the same for the 16 numbers in the top right corner of the four squares.
Similarly for the lower left and right quadrants. The result is:
37 44 24 25 38 43 23 26
28 21 41 40 27 22 42 39
57 56 12 5 58 55 11 6
8 9 53 60 7 10 54 59
34 47 19 30 33 48 20 29
31 18 46 35 32 17 45 36
62 51 15 2 61 52 16 1
3 14 50 63 4 13 49 64
Thus, using the numbers 1 to 64, we have produced 4 magic squares each of
which produce the same sum of 130 across, down and diagonally.
The same rules apply to building a 16 x 16 square using the numbers 1 to 256.
The result is sixteen 4x4 squares whose sum across, down and diagonally for
each of the 4x4s is (1 + 256)*2 = 514.
To the 64 numbers positioned as above [square A], add 64 to each.
The resulting 16x16 square [square B] uses 65 to 128.
To square B, add 64 to each number to generate square C; it will use
the numbers 129 to 192.
Finally, add 64 to each number in square C to make square D which
uses 193 to 256.
Divide each 16x16 square into sixteen little 4x4s and label them thus:
Square A:
a b c d
1 37 44 24 25 38 43 23 26
28 21 41 40 27 22 42 39
2 57 56 12 5 58 55 11 6
8 9 53 60 7 10 54 59
3 34 47 19 30 33 48 20 29
31 18 46 35 32 17 45 36
4 62 51 15 2 61 52 16 1
3 14 50 63 4 13 49 64
Similarly for squares B, C and D.
Take the 4x4 squares a1 in big squares A, B, C and D and position them
according to the order given in the basic 4x4 to make a new 4x4 square.
It will add across, down and diagonally to 514.
37 44 101 108 9 12 6 7
28 21 92 85 position according 8 5 11 10
165 172 229 236 to order of 15 14 4 1
156 149 220 213 2 3 13 16
i.e. smallest number (21) in position 1, next (28) in position 2. 256
goes in position 16 to give:
149 172 92 101
108 85 165 156
229 220 44 21
28 37 213 236
I leave it as an exercise for the reader to construct the remaining 15
4x4 squares.
Richard Cattermoul
T.R | Title | User | Personal Name | Date | Lines |
---|
526.1 | Help on Latin and Orthogonal Latin Squares in note # 421 | THEBUS::KOSTAS | Kostas G. Gavrielidis <o.o> | Wed Jul 09 1986 10:29 | 12 |
|
re. .0
Richard, given your exceptional explanation on how to create Magic
squares, practically of any size, could I ask you to take a look
at Latin and Orthogonal Latin Squares on note # 421, and may be
you can make the same magic as you did for the Magic squares.
Thanks,
Kostas G.
|
526.2 | Here's an exotic one | MODEL::YARBROUGH | | Thu Jan 15 1987 14:34 | 17 |
| The latest issue of ABACUS has an article on magic squares that is both
historically and mathematically interesting. The central idea is the
formation of squares that are magic both arithmetically and lexically. For
example:
five twenty-two eighteen
twenty-eight fifteen two
twelve eight twenty-five
Numerically, the rows, columns, and diagonals add to 45. At the same time,
the number of letters (ignoring hyphens) in each row, column, and diagonal
is twenty-one!
The author of the article gives numerous examples in several languages. In
order to comprehend the historical aspects of the subject, you will have to
read the article. The square above is from a rare book, lost for nearly 100
years, on the worship of trees.
|
526.3 | Solution for odd-sided sequare of any size | AISG::KCHEN | | Thu Mar 22 1990 13:41 | 24 |
| I am surprised that nobody has mentioned a solution for sqaures with
odd number of cells on each side (e.g., 3 by 3, 7 by 7, etc.).
I learned the solution as a kid, and have always thought that
it must have been documented somewhere. FWIW, following is
a pseudo algorithm that will fill an odd-sided magic sqaure
of any size.
Assumption: the size of the square is N by N, where N is any
odd number. For the purpose of this solution, treat
the square as cyclic. I.e., row N is considered to be
next to row 1, and column N is considered to be next
to column 1.
Algorithm:
Let current_cell := the cell at top row, center column;
For I := 1 to N**2
Begin
Put I in current_cell;
Case
The north-east neighbor of current_cell NE is empty: current_cell := NE;
The south neighbor of current_cell S is empty: current_cell := S;
Otherwise: exit;
End;
|
526.4 | | AISG::KCHEN | | Thu Mar 22 1990 15:48 | 6 |
| By the way, I do not have a formal proof that the algorithm
always works. It was just that the several squares of various
sizes that I have tried all came out correct. Come to think of
it, I shouldn't have claimed that it works for odd-sided squares
of ANY SIZE. That's a bit too strong without a proof. Maybe I'll
just leave the proof as a simple excercise for those curious readers. ;-)
|