Office Applications and Entertainment, Magic Squares Index About the Author

 15.0   Special Magic Squares, Bimagic Squares, Part 2 15.4   Bimagic Squares (9 x 9) In his book Magische Quadrate (Version 19, 2017), Holger Danielsson provides a detailed description of classical construction methods of Bimagic Squares of order 9. Following sections are adopted from a few of these descriptions and have been generalised were possible. 15.4.2 Victor Coccoz        (Based on Sudoku Comparable Squares) This method is based on the application of two Sudoku Comparable Squares (B1/B2) as shown below:
B1
 B C A D d M b a c a c b B A C d D M D M d a b c A B C b a c A C B M d D A B C d M D c b a d D M b c a C A B c b a C B A D M d M d D c a b B C A C A B M D d a c b
B2
 R n r Q p S q P s p Q S q s P n r R s q P n R r Q S p n r R S Q p P s q q P s r n R S p Q Q S p P q s r R n P s q R r n p Q S r R n p S Q s q P S p Q s P q R n r
 The resulting Square M1 = 9 * B1 + B2 + 1 will be Associated Magic if following conditions are fulfilled:       A + a = B + b = C + c = D + d = P + p = Q + q = R + r = S + s = 8       M = n = 4       A + B + C + d = a + b + c + D = 16       P + Q + R + S = p + q + r + s = 16 For the numbers {0, 1, ... , 8} this can be realised with the sub sets {0, 3, 6, 7} and {1, 2, 5, 8}, which ensures also that the Associated Square is Bimagic as:       0  + 3  + 6  + 7  = 1  + 2  + 5  + 8       02 + 32 + 62 + 72 = 12 + 22 + 52 + 82 A self explanatory numerical example is shown below:
B1
 3 6 0 1 7 4 5 8 2 8 2 5 3 0 6 7 1 4 1 4 7 8 5 2 0 3 6 5 8 2 0 6 3 4 7 1 0 3 6 7 4 1 2 5 8 7 1 4 5 2 8 6 0 3 2 5 8 6 3 0 1 4 7 4 7 1 2 8 5 3 6 0 6 0 3 4 1 7 8 2 5
B2
 8 4 0 5 6 1 3 2 7 6 5 1 3 7 2 4 0 8 7 3 2 4 8 0 5 1 6 4 0 8 1 5 6 2 7 3 3 2 7 0 4 8 1 6 5 5 1 6 2 3 7 0 8 4 2 7 3 8 0 4 6 5 1 0 8 4 6 1 5 7 3 2 1 6 5 7 2 3 8 4 0
M1 = 9 * B1 + B2 + 1
 36 59 1 15 70 38 49 75 26 79 24 47 31 8 57 68 10 45 17 40 66 77 54 19 6 29 61 50 73 27 2 60 34 39 71 13 4 30 62 64 41 18 20 52 78 69 11 43 48 22 80 55 9 32 21 53 76 63 28 5 16 42 65 37 72 14 25 74 51 35 58 3 56 7 33 44 12 67 81 23 46
 Based on these characteristics 8 Magic Lines can be constructed for both B1 and B2 (ref. Attachment 15.3.21). With routine CnstrSqrs42 128 suitable sets of Sudoku Comparable Squares can be generated, resulting in 128 (32 unique) Bimagic Squares M1 (ref. Attachment 15.4.22, page 1). The resulting squares are Bimagic, Associated with Trimagic Main Diagonals. With an alternative mathematical model:
B1
 D b M d c B C a A c B b a A M d C D C D A B d c b M a b C a c B d D A M B d C A M a c D b M a d D b C A c B A M B C D b a d c d c D M a A B b C a A c b C D M B d
B2
 Q P p S s n R q r S s Q p q r n P R n S R r p q s Q P q r s P R Q p n S P R q s n S Q r p s n P q r p S R Q p q S Q P R r s n r p n R Q P q S s R Q r n S s P p q
 for which following conditions apply:       D + c + B + a = d + C + b + A = 16       Q + p + S + r = q + P + s + R = 16 another 32 suitable sets of Sudoku Comparable Squares can be generated, resulting in 32 (16 Unique) Bimagic Squares M1 (ref. Attachment 15.4.22, page 2). Alternative: The results found above can be used as generator for more Associated Bimagic Squares with Trimagic Diagonals. Based on the applied Sudoku Comparable Squares a collection of 16 (unique) Associated Ternary Squares can be obtained by means of decomposition (ref. Attachment 15.4.23) which result in a (larger) collection of 80 Sudoku Comparable Squares (ref. Attachment 15.4.24) which finally result in a collection of 448 (112 unique) Associated Bimagic Squares with Trimagic Diagonals (ref. Attachment 15.4.25). Note: The Unique Associated Ternary Squares as shown in Attachment 15.4.23 are all different from the Associated Ternary Squares as applied in Section 15.2.4. 15.4.6 Aale De Winkel        (Based on Sudoku Comparable Squares) This method is based on the generation of Sudoku Comparable Squares by means of digital equations. The row and column numbers (z, s) of the square are numbered from 0 to 8 and used as coordinates, which can be converted to ternary numbers by means of following equations:       s = 3 * s(1) + s(2)       z = 3 * z(1) + z(2) with s(i) and z(i) equal to 0, 1 or 2 for i = 1 to 2 e.g. the coordinates (6, 5) can be converted to (20, 12). The ternary components d(1), d(2) of B(z,s) are determined by the formula's:       d(2) = (a(1) * s(1) + a(2) * s(2) + a(3) * z(1) + a(4) * z(2)) Mod 3       d(1) = (b(1) * s(1) + b(2) * s(2) + b(3) * z(1) + b(4) * z(2)) Mod 3 with a(i) and b(i) equal to 0, 1 or 2 for i = 1 ... 4. The resulting decimal value is:       B(z,s) = 3 * d(2) + d(1) Attachment 15.4.60 shows the 864 Sudoku Comparable Squares which could be generated with routine SudSqrs9. Bimagic Squares can be constructed based on two suitable selected Sudoku Comparable Squares (B1, B2) from this collection. Row and column permutations within square B2 are necessary as well as (occasionally) transposition. A self explanatory numerical example (no transposition required) is shown below:
B1
 0 1 2 3 4 5 6 7 8
 0 1 2 3 4 5 6 7 8
 0 3 6 2 5 8 1 4 7 7 1 4 6 0 3 8 2 5 5 8 2 4 7 1 3 6 0 4 7 1 3 6 0 5 8 2 2 5 8 1 4 7 0 3 6 6 0 3 8 2 5 7 1 4 8 2 5 7 1 4 6 0 3 3 6 0 5 8 2 4 7 1 1 4 7 0 3 6 2 5 8
B2
 0 1 2 3 4 5 6 7 8
 0 1 2 3 4 5 6 7 8
 0 3 6 2 5 8 1 4 7 7 1 4 6 0 3 8 2 5 5 8 2 4 7 1 3 6 0 4 7 1 3 6 0 5 8 2 2 5 8 1 4 7 0 3 6 6 0 3 8 2 5 7 1 4 8 2 5 7 1 4 6 0 3 3 6 0 5 8 2 4 7 1 1 4 7 0 3 6 2 5 8
B2'
 0 4 8 7 2 3 5 6 1
 0 4 8 7 2 3 5 6 1
 0 5 7 4 6 2 8 1 3 2 4 6 3 8 1 7 0 5 1 3 8 5 7 0 6 2 4 3 8 1 7 0 5 2 4 6 5 7 0 6 2 4 1 3 8 4 6 2 8 1 3 0 5 7 6 2 4 1 3 8 5 7 0 8 1 3 0 5 7 4 6 2 7 0 5 2 4 6 3 8 1

M1= 9 * B1 + B2' + 1

 0 4 8 7 2 3 5 6 1
 0 4 8 7 2 3 5 6 1
 1 33 62 23 52 75 18 38 67 66 14 43 58 9 29 80 19 51 47 76 27 42 71 10 34 57 5 40 72 11 35 55 6 48 77 25 24 53 73 16 39 68 2 31 63 59 7 30 81 20 49 64 15 44 79 21 50 65 13 45 60 8 28 36 56 4 46 78 26 41 70 12 17 37 69 3 32 61 22 54 74
 De Winkel provides on his website 224 Bimagic Squares constructed in accordance with the principle described above, which are shown in Attachment 15.4.66. Alternative 1: Based on the collection of 864 Sudoku Comparable Squares as deducted above 2304 (1152 unique) Bimagic Squares could be generated, within 1,75 hrs, without any permutation or transposition (ref. Attachment 15.4.63). Alternative 2: Based on the Ternary Components of the above mentioned 224 examples: a collection of 52 (unique) Ternary Squares can be obtained (ref. Attachment 15.4.61, page 1) which result in a collection of 858 Sudoku Comparable Squares (ref. Attachment 15.4.62) which finally result in a collection of 4384 Bimagic Squares (ref. Attachment 15.4.64). Alternative 3: Based on the Ternary Components of the above mentioned 224 examples and 864 Sudoku Comparable Squares together: a collection of 78 (unique) Ternary Squares can be obtained (ref. Attachment 15.4.61, page 2) which result in a collection of 2208 Sudoku Comparable Squares (ref. Attachment 15.4.65) which finally result in a collection of 17016 Bimagic Squares (not available in HTML). Alternative 4: Attachment 15.4.61, page 2 contains 33 (unique) Associated Ternary Squares. from this collection 9 (unique) Associated Ternary Squares can be selected (ref. Attachment 15.4.67), such that these differ also from the Associated Ternary Squares used in Section 15.2.4 which result in a collection of 292 additional Associated Sudoku Comparable Squares which finally result in another 896 (256 unique) Associated Bimagic Squares (ref. Attachment 9.6.10). Note: The 224 examples (Collection A) correspond with 172032 different Bimagic Squares (Collection B), which can be obtained by means of rotation, reflection or transformation (192). The common results of the alternatives described above with Collection A and B are summarised below:
 - Attachment n9 Common with {A} Common with {B} Alternative 1 2304 24 288 Alternative 2 4384 224 1824 Alternative 3 - 17016 224 3200 Alternative 4 896 16 896
 15.4.7 George Chen        (Based on Diagonal Euler Squares) This method is based on the application of two Diagonal Euler Squares (B1/B2) as illustrated in the example below:
b31
 4 3 8 9 5 1 2 7 6
B1
 1 9 5 8 4 3 6 2 7 6 2 7 1 9 5 8 4 3 8 4 3 6 2 7 1 9 5 9 5 1 4 3 8 2 7 6 2 7 6 9 5 1 4 3 8 4 3 8 2 7 6 9 5 1 5 1 9 3 8 4 7 6 2 7 6 2 5 1 9 3 8 4 3 8 4 7 6 2 5 1 9
B2
 8 7 9 2 1 3 5 4 6 2 1 3 5 4 6 8 7 9 5 4 6 8 7 9 2 1 3 9 8 7 3 2 1 6 5 4 3 2 1 6 5 4 9 8 7 6 5 4 9 8 7 3 2 1 7 9 8 1 3 2 4 6 5 1 3 2 4 6 5 7 9 8 4 6 5 7 9 8 1 3 2
b32
 3 2 1 6 5 4 9 8 7
M1a = B1 + 9 * (B2 - 1)
 64 63 77 17 4 21 42 29 52 15 2 25 37 36 50 71 58 75 44 31 48 69 56 79 10 9 23 81 68 55 22 12 8 47 43 33 20 16 6 54 41 28 76 66 62 49 39 35 74 70 60 27 14 1 59 73 72 3 26 13 34 51 38 7 24 11 32 46 45 57 80 67 30 53 40 61 78 65 5 19 18
M1b = B2 + 9 * (B1 - 1)
 8 79 45 65 28 21 50 13 60 47 10 57 5 76 42 71 34 27 68 31 24 53 16 63 2 73 39 81 44 7 30 20 64 15 59 49 12 56 46 78 41 4 36 26 70 33 23 67 18 62 52 75 38 1 43 9 80 19 66 29 58 51 14 55 48 11 40 6 77 25 72 35 22 69 32 61 54 17 37 3 74

It can be noticed that:

• The center square of B1 is a Simple Magic Square of order 3
• The center square of B2 is filled with the numbers 1 ... 9 (natural sequence)

The remainder of both squares is constructed by moving the center squares b31 (b32) horizontally, vertcally or diagoanl wise, where the rows resp. columns of the sub squares are moved (cyclic) as described below:

• square to the top    : the columns are moved 1 step to the right
• square to the bottom : the columns are moved 1 step to the left
• square to the left   : the rows    are moved 1 step to the top
• square to the right  : the rows    are moved 1 step to the bottom

Based on this method 8 * 8 = 64 sets of Diagonal Euler Squares (B1/B2) can be constructed resulting in 128 (80 unique) Bimagic Squares (ref. Attachment 15.4.07).

The resulting squares are Bimagic, Associated and Partly Compact. The elements of the nine regular sub squares return both the magic (369) and the bimagic sum (20049).

Note:
The collection of Partial Compact Bimagic Squares (20736 ea) - as deducted and discussed in Section 15.2.3 - contains 256 Associated Partly Compact Bimagic Squares, which include the 128 Associated Bimagic Squares described above.

15.4.8 Tarry-Cazalas
(Based on Arithmetic Series)

This method is based on a mathematical model (arithmetic series) as illustrated below:

 0 r1 2r1 r2 r2+r1 r2+2r1 2r2 2r2+r1 2r2+2r1 s1 s1+r1 s1+2r1 s1+r2 ... ... ... ... ... 2s1 2s1+r1 2s1+2r1 2s1+r2 ... ... ... ... ... s2 s2+r1 s2+2r1 s2+r2 ... ... ... ... ... s2+s1 ... ... ... ... ... ... ... ... s2+2s1 ... ... ... ... ... ... ... ... 2s2 ... ... ... ... ... ... ... ... 2s2+s1 ... ... ... ... ... ... ... ... 2s2+2s1 ... ... ... ... ... ... ... ...

with key series (r1, r2)3 and (s1, s2)3.
The key series should be selected such that both series result in 32 = 9 different numbers (top row and left column).

An example of the completed model - based on the series (0111, 1021)3 and (2021, 0122)3 - is shown below left:

Base 3
 0000 0111 0222 1021 1102 1210 2012 2120 2201 2021 2102 2210 0012 0120 0201 1000 1111 1222 1012 1120 1201 2000 2111 2222 0021 0102 0210 0122 0200 0011 1110 1221 1002 2101 2212 2020 2110 2221 2002 0101 0212 0020 1122 1200 1011 1101 1212 1020 2122 2200 2011 0110 0221 0002 0211 0022 0100 1202 1010 1121 2220 2001 2112 2202 2010 2121 0220 0001 0112 1211 1022 1100 1220 1001 1112 2211 2022 2100 0202 0010 0121
Bimagic
 1 14 27 35 39 49 60 70 74 62 66 76 6 16 20 28 41 54 33 43 47 55 68 81 8 12 22 18 19 5 40 53 30 65 78 61 67 80 57 11 24 7 45 46 32 38 51 34 72 73 59 13 26 3 23 9 10 48 31 44 79 56 69 75 58 71 25 2 15 50 36 37 52 29 42 77 63 64 21 4 17
 The four digits a, b, c, d of each number should be understood as numbers base 3, resulting in decimal numbers by the equation:               e = a . 32 + b. 32 + c . 3 + d + 1 as illustrated above right. The resulting square is bimagic provided that: The determinant of the series (r1, r2)3 and (s1, s2)3 does not equal to zero; The determinant of the series (r1 + s1, r2 + s2)3 and (r1 - s1, r2 - s2)3 does not equal to zero. Notes: The first condition ensures semi bimagic squares. The second condition ensures that the diagonals are bimagic as well. The calculations have to be executede modulo m = 3. The determinant of a series (a1a2a3a4, b1b2b3b4) is unequal to zero if:        ai . bj  aj . bi ≠ 0 for all possible (six) combinations (ai , bj) with i ≠ j. Based on the 81 numbers base 3 (0000  2222) 672 series (a1, a2)3 can be found for which the determinant does not equal to zero. Based on the method described above a suitable procedure can be prepared which: Selects appropriate series (r1,r2)3 and (s1,s2)3 r1 < s1 prevents transposition (exchange of rows and columns) Checks whether the determinants (r1 + s1, r2 + s2)3 and (r1 - s1, r2 - s2)3 dont equal to zero Completes the model base 3 for the selected series Calculates and checks the resulting bimagic squares. Subject procedure (CnstrSqrs48) generated 1152 (unique) bimagic squares within 21,5 seconds, of which 672 essential different. For all bimagic squares found, the sum of the elements of the nine regular sub squares is bimagic as well. Attachment 15.4.08 showss a possible collection of 672 essential different bimagic squares, resulting in 129024 (= 192 * 672) bimagic squares.        (Based on Sudoku Squares) All 1152 bimagic squares deducted above can be decomposed in pairs of Orthogonal Sudoku Squares - for which also the nine regular sub squares contain the integers 0 ... 8 - as illustrated below:
B1
 0 1 2 3 4 5 6 7 8 6 7 8 0 1 2 3 4 5 3 4 5 6 7 8 0 1 2 1 2 0 4 5 3 7 8 6 7 8 6 1 2 0 4 5 3 4 5 3 7 8 6 1 2 0 2 0 1 5 3 4 8 6 7 8 6 7 2 0 1 5 3 4 5 3 4 8 6 7 2 0 1
B2
 0 4 8 7 2 3 5 6 1 7 2 3 5 6 1 0 4 8 5 6 1 0 4 8 7 2 3 8 0 4 3 7 2 1 5 6 3 7 2 1 5 6 8 0 4 1 5 6 8 0 4 3 7 2 4 8 0 2 3 7 6 1 5 2 3 7 6 1 5 4 8 0 6 1 5 4 8 0 2 3 7
M = 9*B1 + B2 + 1
 1 14 27 35 39 49 60 70 74 62 66 76 6 16 20 28 41 54 33 43 47 55 68 81 8 12 22 18 19 5 40 53 30 65 78 61 67 80 57 11 24 7 45 46 32 38 51 34 72 73 59 13 26 3 23 9 10 48 31 44 79 56 69 75 58 71 25 2 15 50 36 37 52 29 42 77 63 64 21 4 17

The Sudoku Squares obtained by decomposition of all 1152 bimagic squares can be referred to as {B1} and {B2}.

Attachment 15.4.81 shows the 144 different Sudoku Squares of collection {B1}.

Attachment 15.4.82 shows the 240 different Sudoku Squares of collection {B2},
which contains however 108 of the 144 Sudoku Squares of collection {B1}.

Attachment 15.4.83 shows the resulting 276 different Sudoku Squares, further referred to as collection {B}.

Numerous Bimagic Squares can be generated by selecting combinations of Sudoku Squares (B(i), B(j)) while ensuring that the resulting square M contains all integers 1 thru 81 (CnstrSqrs9a):

1. Based on the collection {B}, 2112 Bimagic Squares can be generated by application of:

M = 9 * B(i) + B(j) + 1 with i, j = 1 ... 276 and i ≠ j

2. Based on the collection {B} and the transposed collection {T(B)} another 2112 Bimagic Squares can be generated by application of:

M = 9 * B(i) + T(B(j)) + 1 with i, j = 1 ... 276

While including the transposed squares of a and b above a collection of 8448 Bimagic Squares M can be found.

15.4.9 Donald Keedwell
(Based on Sudoku Squares)

Donald Keedwell studied the construction of Tarry-Cazalas Bimagic Squares based on pairs of Orthogonal Sudoku Squares in more detail.

He defined following three sets of Operator Matrices (Shifts), which can be used for the construction of pairs of Orthogonal Sudoku Squares, based on predefined corner squares M (left/top).

M1
 M Mαβ Mα2β2 Mβ Mαβ2 Mα2 Mβ2 Mα Mα2β
M3
 M Mαβ Mα2β2 Mα2β Mβ2 Mα Mαβ2 Mα2 Mβ
M5
 M Mα Mα2 Mβ2 Mαβ2 Mα2β2 Mβ Mαβ Mα2β
M2
 M Mα2 Mα Mαβ2 Mβ2 Mα2β2 Mα2β Mαβ Mβ
M4
 M Mα2β2 Mαβ Mαβ2 Mβ Mα2 Mα2β Mα Mβ2
M6
 M Mα2 Mα Mβ Mα2β Mαβ Mβ2 Mα2β2 Mαβ2

The operator α moves the rows of M one row upwards (with wrap around).

The operator β moves the columns of M one column to the left (with wrap around).

A self explanatory example, of the application of a set of Keedwell Operators on the corner squares of one of the orthogonal pairs {B1, B2} deducted in Section 15.4.8 above, is shown below:

M1
 M Mαβ Mα2β2 Mβ Mαβ2 Mα2 Mβ2 Mα Mα2β
M2
 M Mα2 Mα Mαβ2 Mβ2 Mα2β2 Mα2β Mαβ Mβ
B1
 0 6 3 4 1 7 8 5 2 7 4 1 2 8 5 3 0 6 5 2 8 6 3 0 1 7 4 6 3 0 1 7 4 5 2 8 4 1 7 8 5 2 0 6 3 2 8 5 3 0 6 7 4 1 3 0 6 7 4 1 2 8 5 1 7 4 5 2 8 6 3 0 8 5 2 0 6 3 4 1 7
B2
 0 7 5 1 8 3 2 6 4 2 6 4 0 7 5 1 8 3 1 8 3 2 6 4 0 7 5 4 2 6 5 0 7 3 1 8 3 1 8 4 2 6 5 0 7 5 0 7 3 1 8 4 2 6 8 3 1 6 4 2 7 5 0 7 5 0 8 3 1 6 4 2 6 4 2 7 5 0 8 3 1
M = 9*B1 + B2 + 1
 1 62 33 38 18 67 75 52 23 66 43 14 19 80 51 29 9 58 47 27 76 57 34 5 10 71 42 59 30 7 15 64 44 49 20 81 40 11 72 77 48 25 6 55 35 24 73 53 31 2 63 68 39 16 36 4 56 70 41 12 26 78 46 17 69 37 54 22 74 61 32 3 79 50 21 8 60 28 45 13 65
 Attachment 15.4.94 shows a collection of 192 different Tarry-Cazalas Squares, which can be constructed based on the three sets of Keedwell Operator Matrices (ref. CnstrSqrs9c). Alternative 1: More Bimagic Squares can be constructed with the Keedwell Operators when applied on alternative corner squares. Attachment 15.4.91 shows 46 (24 unique) different corner squares, which can be extracted from the 276 different Sudoku Squares found in Section 15.4.8 above. Attachment 15.4.93 shows 276 (= 6 * 46) different Sudoku Squares, constructed based on the Keedwell Operatrs, with 92 Sudoku Squares in common with Attachment 15.4.83. Numerous Bimagic Squares can be constructed by selecting combinations of Sudoku Squares (B'(i), B'(j)) while ensuring that the resulting square M contains all integers 1 thru 81 (CnstrSqrs9a). Attachment 15.4.95 shows the resulting 704 different Bimagic Squares, whcic include the 192 Tarry Cazalas Squares as shown in Attachment 15.4.94. Alternative 2: More Keedwell Operator based Sudoku Squares - and consequently more Bimagic Squares - can be constructed when all aspects of the 24 unique corner squares are considered. Attachment 15.4.92 shows 192 (= 8 * 24) different corner squares, obtained by means of rotation and reflection of the 24 unique corner squares contained in Attachment 15.4.91. Attachment 15.4.96 shows 1152 (= 6 * 192) different Sudoku Squares, constructed based on the Keedwell Operatrs, with 92 Sudoku Squares in common with Attachment 15.4.83. Based on the 1152 Keedwell Operator based Sudoku Squares, 12288 (= 2 * 192 * 32) Bimagic Squares can be constructed (ref. CnstrSqrs9a). 15.4.10 Summary The obtained results regarding the miscellaneous types of order 9 Bimagic Squares as deducted and discussed in previous sections are summarized in following table:
 Main Characteristics Original Author(s) Subroutine Results Bimagic Squares, Sudoku Based Victor Coccoz Alternative 1 Bimagic Squares, Sudoku Based Aale De Winkel - Alternative 1 Alternative 2 Bimagic Squares, Euler Based George Chen - Bimagic Squares, Aritmetic Series Tarry-Cazalas Bimagic Squares, Sudoku Based Donald Keedwell Bimagic Squares Alternative 1
 Next section will provide an alternative construction method for Associated Bimagic Squares of order 9.