Office Applications and Entertainment, Magic Squares

Vorige Pagina Volgende Pagina Index About the Author

7.0†††Magic Squares (7 x 7)

7.1†††Analytic Solution, Pan Magic Squares

Pan Magic Squares of order 7 can be represented as follows:

a(1) a(2) a(3) a(4) a(5) a(6) a(7)
a(8) a(9) a(10) a(11) a(12) a(13) a(14)
a(15) a(16) a(17) a(18) a(19) a(20) a(21)
a(22) a(23) a(24) a(25) a(26) a(27) a(28)
a(29) a(30) a(31) a(32) a(33) a(34) a(35)
a(36) a(37) a(38) a(39) a(40) a(41) a(42)
a(43) a(44) a(45) a(46) a(47) a(48) a(49)

As the numbers a(i), i = 1 ... 49, in all rows, columns and diagonals sum to the same constant this results in following linear equations:

a( 1) + a( 2) + a( 3) + a( 4) + a( 5) + a( 6) + a( 7) = s1
a( 8) + a( 9) + a(10) + a(11) + a(12) + a(13) + a(14) = s1
a(15) + a(16) + a(17) + a(18) + a(19) + a(20) + a(21) = s1
a(22) + a(23) + a(24) + a(25) + a(26) + a(27) + a(28) = s1
a(29) + a(30) + a(31) + a(32) + a(33) + a(34) + a(35) = s1
a(36) + a(37) + a(38) + a(39) + a(40) + a(41) + a(42) = s1
a(43) + a(44) + a(45) + a(46) + a(47) + a(48) + a(49) = s1

a( 1) + a( 8) + a(15) + a(22) + a(29) + a(36) + a(43) = s1
a( 2) + a( 9) + a(16) + a(23) + a(30) + a(37) + a(44) = s1
a( 3) + a(10) + a(17) + a(24) + a(31) + a(38) + a(45) = s1
a( 4) + a(11) + a(18) + a(25) + a(32) + a(39) + a(46) = s1
a( 5) + a(12) + a(19) + a(26) + a(33) + a(40) + a(47) = s1
a( 6) + a(13) + a(20) + a(27) + a(34) + a(41) + a(48) = s1
a( 7) + a(14) + a(21) + a(28) + a(35) + a(42) + a(49) = s1

a( 1) + a( 9) + a(17) + a(25) + a(33) + a(41) + a(49) = s1
a( 2) + a(10) + a(18) + a(26) + a(34) + a(42) + a(43) = s1
a( 3) + a(11) + a(19) + a(27) + a(35) + a(36) + a(44) = s1
a( 4) + a(12) + a(20) + a(28) + a(29) + a(37) + a(45) = s1
a( 5) + a(13) + a(21) + a(22) + a(30) + a(38) + a(46) = s1
a( 6) + a(14) + a(15) + a(23) + a(31) + a(39) + a(47) = s1
a( 7) + a( 8) + a(16) + a(24) + a(32) + a(40) + a(48) = s1

a( 7) + a(13) + a(19) + a(25) + a(31) + a(37) + a(43) = s1
a( 6) + a(12) + a(18) + a(24) + a(30) + a(36) + a(49) = s1
a( 5) + a(11) + a(17) + a(23) + a(29) + a(42) + a(48) = s1
a( 4) + a(10) + a(16) + a(22) + a(35) + a(41) + a(47) = s1
a( 3) + a( 9) + a(15) + a(28) + a(34) + a(40) + a(46) = s1
a( 2) + a( 8) + a(21) + a(27) + a(33) + a(39) + a(45) = s1
a( 1) + a(14) + a(20) + a(26) + a(32) + a(38) + a(44) = s1

Or in matrix representation:

††††††††††††
†††††A * a = s1

Which can be reduced, by means of row and column manipulations, to:

a(43) = s1 - a(44) - a(45) - a(46) - a(47) - a(48) - a(49)
a(36) = s1 - a(37) - a(38) - a(39) - a(40) - a(41) - a(42)
a(29) = s1 - a(30) - a(31) - a(32) - a(33) - a(34) - a(35)
a(22) = s1 - a(23) - a(24) - a(25) - a(26) - a(27) - a(28)
a(21) = s1 - a(22) - a(27) - a(28) + a(31) + a(32) - a(35) - a(36) - a(41) - a(42) - a(49)
a(20) = s1 - a(26) - a(27) - a(28) + a(30) + a(31) - a(34) - a(40) - a(41) - a(42) - a(48)
a(19) = s1 - a(25) - a(26) - a(27) + a(29) + a(30) - a(33) - a(39) - a(40) - a(41) - a(47)
a(18) = s1 - a(24) - a(25) - a(26) + a(29) - a(32) + a(35) - a(38) - a(39) - a(40) - a(46)
a(17) = s1 - a(23) - a(24) - a(25) - a(31) + a(34) + a(35) - a(37) - a(38) - a(39) - a(45)
a(16) = s1 - a(22) - a(23) - a(24) - a(30) + a(33) + a(34) - a(36) - a(37) - a(38) - a(44)
a(15) = s1 - a(16) - a(17) - a(18) - a(19) - a(20) - a(21)
a(14) =††††- a(21) + a(29) + a(34) - a(38) - a(39) + a(43) + a(48)
a(13) =††††††a(14) + a(15) - a(20) + a(23) - a(27) + a(31) - a(34) + a(39) - a(41) + a(47) - a(48)
a(12) =††††††a(13) - a(19) + a(21) + a(22) - a(26) + a(30) - a(33) + a(38) - a(40) + a(46) - a(47)
a(11) =††††††a(12) - a(18) + a(20) - a(25) + a(28) + a(29) - a(32) + a(37) - a(39) + a(45) - a(46)
a(10) =††††††a(11) - a(17) + a(19) - a(24) + a(27) - a(31) + a(35) + a(36) - a(38) + a(44) - a(45)
a( 9) =††††††a(10) - a(16) + a(18) - a(23) + a(26) - a(30) + a(34) - a(37) + a(42) + a(43) - a(44)
a( 8) = s1 - a( 9) - a(10) - a(11) - a(12) - a(13) - a(14)
a( 7) = s1 - a(14) - a(21) - a(28) - a(35) - a(42) - a(49)
a( 6) = s1 - a(13) - a(20) - a(27) - a(34) - a(41) - a(48)
a( 5) = s1 - a(12) - a(19) - a(26) - a(33) - a(40) - a(47)
a( 4) = s1 - a(11) - a(18) - a(25) - a(32) - a(39) - a(46)
a( 3) = s1 - a(10) - a(17) - a(24) - a(31) - a(38) - a(45)
a( 2) = s1 - a( 9) - a(16) - a(23) - a(30) - a(37) - a(44)
a( 1) = s1 - a( 2) - a( 3) - a( 4) - a( 5) - a( 6) - a( 7)

The linear equations shown above, are ready to be solved, for the magic constant 175.

However the solutions can only be obtained by guessing a(23) ... a(28), a(30) ... a(35), a(37) ... a(42) and a(44) ... a(49) and filling out these guesses in the abovementioned equations.

For distinct integers also following inequalities should be applied:

0 < a(i) =< 49††††††††for i = 1, 2 ... 22, 29, 36 and 43
a(i) ≠ a(j)†††††††††††for i ≠ j

An optimized guessing routine (MgcSqr7a) produced, with a careful variation of the independent variables, 16 Magic Squares within 11 minutes, which are shown in Attachment 7.1.1.

Any 7th order Pan Magic Squares, is part of a collection {Aijk} of 392 elements obtained by means of rotation, reflection, column and/or row shifts (ref. Attachment 7.3).

7.2†††Sudoku Comparable Method

More successfully, Pan Magic Squares of order 7 can be constructed by means of following Sudoku Comparable Method:

  1. Fill the first row of square A and square B with the numbers 0, 1, 2, 3, 4, 5 and 6.
    While starting with 0 there are 6! = 720 possible combinations for each square.

  2. Complete square A and B by copying the first row into the following rows of the applicable square, according to one of the following schemes:

    1. A: shift 2 columns to the left / B: shift 2 columns to the right
    2. A: shift 2 columns to the left / B: shift 3 columns to the right
    3. A: shift 2 columns to the left / B: shift 3 columns to the left
    4. A: shift 3 columns to the left / B: shift 2 columns to the right
    5. A: shift 3 columns to the left / B: shift 3 columns to the right
    6. A: shift 3 columns to the left / B: shift 2 columns to the left

  3. Construct the final square C by means of the matrix operation C = 7 * A + B + [1].

Which can be realized by means of an Excel spreadsheet as shown below:

The applicable Sudoku Comparable Squares described above, generated with routine SudSqr7a in 150 seconds (4 x 37,5), are shown in Attachment 7.3.4.

The possible combinations of square A and B described above will result in 6 * 720 * 720/4 = 777.600 unique solutions.

Each of these 777.600 Pan Magic Squares will result in a unique Class Cn and finally in 777.600 * 49 * 8 = 304.819.200 possible Pan Magic Squares of the 7th order.

Collections of Pan Magic Squares, based on Sudoku Comparable Squares, can be generated very fast with routine CnstrSqrs7a.

7.3†††Further Analysis, Ultramagic Squares

7.3.1General

Ultra Magic Squares can be defined as a Symmetric Pan Magic Squares.

In a Symmetric Magic Square, the sum of each pair of elements, which can be connected with a straight line through the centre and which are equidistant to the centre, is 1 + n x n. For a 7th order Pan Magic Square these pairs sum to 50.

a(1) a(2) a(3) a(4) a(5) a(6) a(7)
a(8) a(9) a(10) a(11) a(12) a(13) a(14)
a(15) a(16) a(17) a(18) a(19) a(20) a(21)
a(22) a(23) a(24) a(25) a(26) a(27) a(28)
a(29) a(30) a(31) a(32) a(33) a(34) a(35)
a(36) a(37) a(38) a(39) a(40) a(41) a(42)
a(43) a(44) a(45) a(46) a(47) a(48) a(49)

This results in following additional equations:

a(1) + a(49) = 50
a(2) + a(48) = 50
a(3) + a(47) = 50
a(4) + a(46) = 50
a(5) + a(45) = 50
a(6) + a(44) = 50

a( 7) + a(43) = 50
a( 8) + a(42) = 50
a( 9) + a(41) = 50
a(10) + a(40) = 50
a(11) + a(39) = 50
a(12) + a(38) = 50

a(13) + a(37) = 50
a(14) + a(36) = 50
a(15) + a(35) = 50
a(16) + a(34) = 50
a(17) + a(33) = 50
a(18) + a(32) = 50

a(19) + a(31) = 50
a(20) + a(30) = 50
a(21) + a(29) = 50
a(22) + a(28) = 50
a(23) + a(27) = 50
a(24) + a(26) = 50

which can be added to the equations describing a Pan Magic Square of the 7th order (Section 7.1), and results in following linear equations:

a(43) =  175 - a(44) - a(45) - a(46) - a(47) - a(48) - a(49)
a(36) =  175 - a(37) - a(38) - a(39) - a(40) - a(41) - a(42)
a(35) =  150 - a(41) - a(42) - a(47) - a(48) - a(49)
a(34) =        a(35) + a(37) - a(40) + a(44) + a(45) - a(46) - a(48)
a(33) =  150 + a(38) - a(39) - a(40) - a(41) + a(44) - 2 * a(47) - a(48) - a(49)
a(32) =  150 - a(38) - a(40) - a(44) - a(46) - a(48)
a(31) =  300 - a(33) - a(37) - 2 * a(39) - a(41) - a(43) - 2 * a(45) - 2 * a(47) - a(49)
a(30) = -200 + a(39) + a(40) + 2 * a(41) + a(42) - a(44) + 2 * a(47) + 2 * a(48) + a(49)
a(29) = -200 + a(38) + a(39) + a(40) + a(41) + a(42) + a(46) + a(47) + a(48) + a(49)
a(28) =   25 - a(37) + a(41) - a(44) - a(45) + a(47) + a(48)
a(27) = -325 + a(39) + 2 * a(40) + 2 * a(41) + 2 * a(42) - a(44) - a(45) + a(46) + 3*a(47) + 3*a(48) + 2*a(49)
a(26) =        a(27) + a(36) - a(42) + a(45) - a(47)
a(25) =   25

a(24) = 50 - a(26)
a(23) = 50 - a(27)
a(22) = 50 - a(28)
a(21) = 50 - a(29)
a(20) = 50 - a(30)
a(19) = 50 - a(31)

a(18) = 50 - a(32)
a(17) = 50 - a(33)
a(16) = 50 - a(34)
a(15) = 50 - a(35)
a(14) = 50 - a(36)
a(13) = 50 - a(37)

a(12) = 50 - a(38)
a(11) = 50 - a(39)
a(10) = 50 - a(40)
a( 9) = 50 - a(41)
a( 8) = 50 - a(42)
a( 7) = 50 - a(43)

a(6) = 50 - a(44)
a(5) = 50 - a(45)
a(4) = 50 - a(46)
a(3) = 50 - a(47)
a(2) = 50 - a(48)
a(1) = 50 - a(49)

An optimized guessing routine (Priem7c) produced, with a(49) = 1, a(48) = 9 and a(47) = 27, 531 Ultra Magic Squares within 3,25 hrs, which are shown in Attachment 7.4.1.

7.3.2Sudoku Comparable Method

Comparable with the method described in Section 7.2 above, also any Ultra Magic Square M of order 7 - based on the distinct integers 1 ... 49 - can be written as M = B1 + 7 * B2 + [1]

The rows, columns and (pan) diagonals of the matrices B1 and B2 - further referred to as Sudoku Comparble Squares - contain only the integers 0, 1, 2, 3, 4, 5 and 6 and will sum to the Magic Sum 21.

Sudoku Comparable Squares as described above can be obtained by applying the same equations as deducted in Section 7.3.1, however for a Magic Sum 21.

An optimized guessing routine (SudSqr7b) produced 192 Sudoku Comparable Ultra Magic Squares within 22.8 seconds, which are shown in Attachment 7.4.3.

Based on this collection, 27648 (= 192 * 144) Ultra Magic Squares cuold be generated with routine CnstrSqrs7b within 10 minutes, of which the first 144 are shown in Attachment 7.4.4.

7.3.3Class Definition

Each 7th order Ultra Magic Square corresponds with miscellaneous other Ultra Magic Squares which can be obtained by means of transformations as described below:

  • Transformation K (Trump), which results in a (Sub) Class of 6 Ultra Magic Squares (Ref. Attachment 7.2.1);

  • Transformation W (Gaspalou), which results in a (Sub) Class of 2 Ultra Magic Squares (Ref. Attachment 7.2.2);

  • The resulting number of transformations is 2 * 6 = 12.

Based on this set of transformations and the eight squares which can be found by means of rotation and/or reflection, any 7th order Ultra Magic Square corresponds with a Class of 8 * 12 = 96 Ultra Magic Squares (ref. Attachment 7.2.4).

7.3.4Three Cell Patterns

In following Ultra Magic Square, previously published as a part of Walter Trumpís detailed study regarding Ultra Magic Squares of order 7, all 3-cell patterns sum to 75 (= 3 * 25).

16 41 18 2 33 35 30
45 1 38 42 3 7 39
29 23 14 31 46 26 6
10 28 37 25 13 22 40
44 24 4 19 36 27 21
11 43 47 8 12 49 5
20 15 17 48 32 9 34

The equations describing Ultra Magic Squares with this additional property can be written as:

a(47) =  75 - a(48) - a(49)
a(43) = 100 - a(44) - a(45) - a(46)
a(40) =  75 - (2*a(41) + a(42) + a(46) + a(48) - a(49))/2
a(38) =  75 + a(39) - a(40) - a(44) - a(48)
a(37) =  75 - a(44) - a(45)
a(36) =  25 - 2 * a(39) - a(41) - a(42) + 2 * a(44) + a(45) + a(48)
a(35) =  75 - a(41) - a(42)
a(34) =       a(40) + a(41) - a(49)
a(33) = -75 + a(41) + a(42) + a(46) + a(48)
a(32) =  75 - a(39) - a(46)
a(31) =  50 - 2 * a(39) - 2 * a(41) - a(42) + 2 * a(44) + a(48) + a(49)
a(30) =  25 + a(38) - a(46)
a(29) = -50 + 2 * a(39) + a(41) + a(42) - a(44) + a(46) - a(48)
a(28) =  25 + a(41) - a(49)
a(27) =  50 + a(39) + a(42) - a(44) - a(45) - a(48)
a(26) =     - a(39) - a(41) - a(42) + a(44) + a(45) + a(48) + a(49)
a(25) =  25

a(24) = 50 - a(26)
a(23) = 50 - a(27)
a(22) = 50 - a(28)
a(21) = 50 - a(29)
a(20) = 50 - a(30)
a(19) = 50 - a(31)

a(18) = 50 - a(32)
a(17) = 50 - a(33)
a(16) = 50 - a(34)
a(15) = 50 - a(35)
a(14) = 50 - a(36)
a(13) = 50 - a(37)

a(12) = 50 - a(38)
a(11) = 50 - a(39)
a(10) = 50 - a(40)
a( 9) = 50 - a(41)
a( 8) = 50 - a(42)
a( 7) = 50 - a(43)

a(6) = 50 - a(44)
a(5) = 50 - a(45)
a(4) = 50 - a(46)
a(3) = 50 - a(47)
a(2) = 50 - a(48)
a(1) = 50 - a(49)

with the independent variables a(39), a(41), a(42), a(44), a(45), a(46), a(48) and a(49).

An optimized guessing routine (MgcSqr7c), produced 104 Ultra Magic Squares as defined above, which are shown in Attachment 7.4.2.

7.3.5Other Patterns

As a part of the study mentioned in Section 7.3.4 above, Walter introduced many other Special Ultra Magic Squares, amongst others Inlaid Magic Squares as discussed in Section 7.6.4 thru 7.6.9.


Vorige Pagina Volgende Pagina Index About the Author