Office Applications and Entertainment, Magic Squares

Vorige Pagina Volgende Pagina Index About the Author

8.0   Magic Squares (8 x 8)

8.1   Pan Magic Squares, General

8.1.1 Analytic Solution

A Magic Square for which all rows, columns and all diagonals sum to the same constant is normally referred to as a Pan Magic Square.

Magic squares of order 8 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)

a(50)

a(51)

a(52)

a(53)

a(54)

a(55)

a(56)

a(57)

a(58)

a(59)

a(60)

a(61)

a(62)

a(63)

a(64)

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

a( 1) + a( 2) + a( 3) + a( 4) + a( 5) + a( 6) + a( 7) + a( 8) = s1
a( 9) + a(10) + a(11) + a(12) + a(13) + a(14) + a(15) + a(16) = s1
a(17) + a(18) + a(19) + a(20) + a(21) + a(22) + a(23) + a(24) = s1
a(25) + a(26) + a(27) + a(28) + a(29) + a(30) + a(31) + a(32) = s1
a(33) + a(34) + a(35) + a(36) + a(37) + a(38) + a(39) + a(40) = s1
a(41) + a(42) + a(43) + a(44) + a(45) + a(46) + a(47) + a(48) = s1
a(49) + a(50) + a(51) + a(52) + a(53) + a(54) + a(55) + a(56) = s1
a(57) + a(58) + a(59) + a(60) + a(61) + a(62) + a(63) + a(64) = s1

a( 1) + a( 9) + a(17) + a(25) + a(33) + a(41) + a(49) + a(57) = s1
a( 2) + a(10) + a(18) + a(26) + a(34) + a(42) + a(50) + a(58) = s1
a( 3) + a(11) + a(19) + a(27) + a(35) + a(43) + a(51) + a(59) = s1
a( 4) + a(12) + a(20) + a(28) + a(36) + a(44) + a(52) + a(60) = s1
a( 5) + a(13) + a(21) + a(29) + a(37) + a(45) + a(53) + a(61) = s1
a( 6) + a(14) + a(22) + a(30) + a(38) + a(46) + a(54) + a(62) = s1
a( 7) + a(15) + a(23) + a(31) + a(39) + a(47) + a(55) + a(63) = s1
a( 8) + a(16) + a(24) + a(32) + a(40) + a(48) + a(56) + a(64) = s1

a( 1) + a(10) + a(19) + a(28) + a(37) + a(46) + a(55) + a(64) = s1
a( 2) + a(11) + a(20) + a(29) + a(38) + a(47) + a(56) + a(57) = s1
a( 3) + a(12) + a(21) + a(30) + a(39) + a(48) + a(49) + a(58) = s1
a( 4) + a(13) + a(22) + a(31) + a(40) + a(41) + a(50) + a(59) = s1
a( 5) + a(14) + a(23) + a(32) + a(33) + a(42) + a(51) + a(60) = s1
a( 6) + a(15) + a(24) + a(25) + a(34) + a(43) + a(52) + a(61) = s1
a( 7) + a(16) + a(17) + a(26) + a(35) + a(44) + a(53) + a(62) = s1
a( 8) + a( 9) + a(18) + a(27) + a(36) + a(45) + a(54) + a(63) = s1

a( 8) + a(15) + a(22) + a(29) + a(36) + a(43) + a(50) + a(57) = s1
a( 7) + a(14) + a(21) + a(28) + a(35) + a(42) + a(49) + a(64) = s1
a( 6) + a(13) + a(20) + a(27) + a(34) + a(41) + a(56) + a(63) = s1
a( 5) + a(12) + a(19) + a(26) + a(33) + a(48) + a(55) + a(62) = s1
a( 4) + a(11) + a(18) + a(25) + a(40) + a(47) + a(54) + a(61) = s1
a( 3) + a(10) + a(17) + a(32) + a(39) + a(46) + a(53) + a(60) = s1
a( 2) + a( 9) + a(24) + a(31) + a(38) + a(45) + a(52) + a(59) = s1
a( 1) + a(16) + a(23) + a(30) + a(37) + a(44) + a(51) + a(58) = s1

Or in matrix representation:

            
     A * a = s1

which can be reduced, by means of row and column manipulations, and results in following linear equations:

a(57) =     s1 - a(58) - a(59) - a(60) - a(61) - a(62) - a(63) - a(64)
a(49) =     s1 - a(50) - a(51) - a(52) - a(53) - a(54) - a(55) - a(56)
a(41) =     s1 - a(42) - a(43) - a(44) - a(45) - a(46) - a(47) - a(48)
a(33) =     s1 - a(34) - a(35) - a(36) - a(37) - a(38) - a(39) - a(40)
a(25) =     s1 - a(26) - a(27) - a(28) - a(29) - a(30) - a(31) - a(32)
a(23) = 3 * s1 - a(24) - a(25) - a(30) - 2 * a(31) - 2 * a(32) - a(33) + a(35) + a(36) - a(38) - 2 * a(39) +
               - 2 * a(40) - a(41) + a(43) + a(44) - a(46) - 2 * a(47) - 2 * a(48) - a(49) - a(54) - 2 * a(55) +
               - 2 * a(56) - a(63) - a(64)
a(22) = 2 * s1 + a(24) + a(25) - a(29) - a(30) + a(32) - a(35) - 2 * a(36) - 2 * a(37) - 2 * a(38) - a(39) +
               - a(43) - 2 * a(44) - 2 * a(45) - 2 * a(46) - a(47) + a(49) - a(53) - a(54) + a(56) - a(62) + a(64)
a(21) =     s1 - a(24) + a(26) + a(27) - a(37) - a(38) - a(39) - a(40) - a(45) - a(46) - a(47) - a(48) +
               + a(50) + a(51) - a(61) - a(64)
a(20) =          a(21) - a(23) + a(24) + a(25) - a(27) - a(36) + a(40) - a(44) + a(48) + a(49) - a(51) +
               - a(60) + a(61) - a(63) + a(64)
a(19) =     s1 - a(24) + a(29) + a(30) - a(33) - a(34) - a(35) - a(40) - a(41) - a(42) - a(43) - a(48) +
               + a(53) + a(54) - a(59) - a(64)
a(18) =     s1 - a(21) + a(31) + a(32) - a(34) - a(35) - a(36) - a(37) - a(42) - a(43) - a(44) - a(45) +
               + a(55) + a(56) - a(58) - a(61)
a(17) =     s1 - a(18) - a(19) - a(20) - a(21) - a(22) - a(23) - a(24)
a(16) = - s1/2 - a(23) - a(24) - a(30) - a(31) - a(32) + a(33) + a(34) + a(35) + a(36) + a(41) + a(42) +
               + a(43) + a(49) + a(50) + a(57)
a(15) =          a(16) - a(22) + a(24) - a(29) + a(32) - a(36) + a(40) - a(43) + a(48) - a(50) + a(56) +
               - a(57) + a(64)
a(14) =          a(16) + a(17) - a(21) + a(26) - a(28) - a(42) + a(44) - a(49) + a(53) + a(62) - a(64)
a(13) =          a(15) - a(20) + a(24) + a(25) - a(27) - a(41) + a(43) + a(52) - a(56) + a(61) - a(63)
a(12) =          a(14) - a(19) + a(23) - a(26) + a(32) + a(42) - a(48) + a(51) - a(55) + a(60) - a(62)
a(11) =          a(13) - a(18) + a(22) - a(25) + a(31) + a(41) - a(47) + a(50) - a(54) + a(59) - a(61)
a(10) =          a(12) - a(17) + a(21) + a(30) - a(32) - a(46) + a(48) + a(49) - a(53) + a(58) - a(60)
a( 9) =     s1 - a(10) - a(11) - a(12) - a(13) - a(14) - a(15) - a(16)
a( 8) =     s1 - a(16) - a(24) - a(32) - a(40) - a(48) - a(56) - a(64)
a( 7) =     s1 - a(15) - a(23) - a(31) - a(39) - a(47) - a(55) - a(63)
a( 6) =     s1 - a(14) - a(22) - a(30) - a(38) - a(46) - a(54) - a(62)
a( 5) =     s1 - a(13) - a(21) - a(29) - a(37) - a(45) - a(53) - a(61)
a( 4) =     s1 - a(12) - a(20) - a(28) - a(36) - a(44) - a(52) - a(60)
a( 3) =     s1 - a(11) - a(19) - a(27) - a(35) - a(43) - a(51) - a(59)
a( 2) =     s1 - a(10) - a(18) - a(26) - a(34) - a(42) - a(50) - a(58)
a( 1) =     s1 - a( 2) - a( 3) - a( 4) - a( 5) - a( 6) - a( 7) - a( 8)

However the solutions can only be obtained by guessing a(24), a(26) ... a(32), a(34) ... a(40), a(42) ... a(48),
a(50) ... a(56) and a(58) ... a(64) and filling out these guesses in the abovementioned equations.

For distinct integers also following inequalities should be applied:

0 < a(i) =< 64        for i = 1, 2, ... 23, 25, 33, 41, 49, 57
a(i) ≠ a(j)           for i ≠ j

which can be incorporated in a guessing routine, which might be used to generate - if not all - at least collections of 8th order squares with distinct integers within a reasonable time.

Any 8th order Pan Magic Square, is part of a collection {Aijk} of 512 elements obtained by means of rotation, reflection, column and/or row shifts (ref. Attachment 8.1.3 ).

8.1.2 Further Analysis, Matrix Operation

Rather than trying to find solutions based on the equations deducted in section 8.1.1 above, the construction method described in section 13.4 will be used as a starting point for the generation of 8th order Pan Magic Squares.

As illustrated in section 13.4 an individual Pan Magic Square of order 8 can be constructed by means of following method:

  1. Fill the first 4 columns of the first row of square A with 4 different natural numbers 1 =< n =< 8;
  2. Fill the first 4 columns of the second row with 4 other different natural numbers 1 =< n =< 8, such that each vertical pair will have the same sum;
  3. Copy the resulting 2 × 4 rectangle 3 times under the first rectangle;
  4. Copy the resulting left 8 × 4 rectangle into the right 8 × 4 rectangle but shift it ring-wise by one row;
  5. Construct a second square R by means of 90o rotation of square A;
  6. Construct square B by means of the matrix operation B = 8 * R + A - 8.

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

The 384 possible solutions, generated with routine MgcSqr8a within 86,5 seconds, are shown in Attachment 8.1.4 and further referred to as Collection {B}.

However, not all elements of Collection {B} will result in a unique Class {Aijk}.

If the first square of Collection {B} is used as a base square, the resulting Class (ref. Attachment 8.1.5) will contain 15 other elements of {B} (highlighted in red), due to the method the squares of {B} have been constructed.

These 15 squares should be excluded from the collection of possible base squares. Continuing like this, a collection of 24 (= 384/16) possible base squares will remain (ref. Attachment 8.1.6).

Consequently, based on the method described above, 24 * 512 = 12288 Pan Magic Squares of order 8 can be constructed.

The resulting 8 × 8 Pan Magic Squares are also Most Perfect Magic Squares as defined in section 2.4:

  1. Compact : Each 2 × 2 sub square sums to 2 * (82 + 1) = 130, which will be discussed in section 8.4;
  2. Complete: All pairs of integers distant 8/2 = 4 along a main- and broken diagonals sum to (82 + 1) = 65.

The generation of all possible order 8 Most Perfect Magic Squares (64 * 46080 = 2949120) will be discussed in Section 8.5.5.

Other interesting sub collections of order 8 (Pan) Magic Squares will be discussed in following section(s).


Vorige Pagina Volgende Pagina Index About the Author