' Constructs Associated Magic Cubes (6 x 6 x 6)
' Trenkler Principle

' Tested with Office 2007 under Windows 7

```Sub MgcCube6b()

Dim a1(8), c(216), b(6), b1(27), a(216)

y = MsgBox("Blocked", 0, "MgcCube6b")
End

a1(1) = 0: a1(2) = 3: a1(3) = 5: a1(4) = 6:
a1(5) = 1: a1(6) = 2: a1(7) = 4: a1(8) = 7:

' Define Simple Magic Cube

b1(19) = 10: b1(20) = 8:  b1(21) = 24: b1(22) = 5:  b1(23) = 21: b1(24) = 16: b1(25) = 27: b1(26) = 13: b1(27) = 2:
b1(10) = 6:  b1(11) = 19: b1(12) = 17: b1(13) = 25: b1(14) = 14: b1(15) = 3:  b1(16) = 11: b1(17) = 9:  b1(18) = 22:
b1(1) = 26:  b1(2) = 15:  b1(3) = 1:   b1(4) = 12:  b1(5) = 7:   b1(6) = 23:  b1(7) = 4:   b1(8) = 20:  b1(9) = 18:

n1 = 0: n9 = 0: n10 = 0: k1 = 1: k2 = 1

t1 = Timer

' Center Planes

For j108 = 1 To 4
c(108) = a1(j108)
For j107 = 1 To 4
If j107 = j108 Then GoTo 1070
c(107) = a1(j107)
For j106 = 1 To 4
c(106) = a1(j106)
For j105 = 1 To 4
If j105 = j106 Then GoTo 1050
c(105) = a1(j105)
For j104 = 1 To 4
c(104) = a1(j104)

c(103) = 21 - c(104) - c(105) - c(106) - c(107) - c(108)
If c(103) <> a1(1) And c(103) <> a1(2) And c(103) <> a1(3) And c(103) <> a1(4) Then GoTo 1040
If c(103) = c(104) Then GoTo 1040

For j102 = 1 To 4
c(102) = a1(j102)
If j102 = j107 Or j102 = j108 Then GoTo 1020
c(101) = 14 - c(102) - c(107) - c(108)

For j100 = 1 To 4
c(100) = a1(j100)
If j100 = j105 Or j100 = j106 Then GoTo 1000
c(99) = 14 - c(100) - c(105) - c(106)

For j98 = 1 To 4
c(98) = a1(j98)
If c(98) = c(103) Or c(98) = c(104) Then GoTo 980
c(97) = 14 - c(98) - c(103) - c(104)

For j96 = 1 To 4
c(96) = a1(j96)
For j95 = 1 To 4
If j95 = j96 Then GoTo 950
c(95) = a1(j95)
For j94 = 1 To 4
c(94) = a1(j94)
For j93 = 1 To 4
If j93 = j94 Then GoTo 930
c(93) = a1(j93)
For j92 = 1 To 4
c(92) = a1(j92)

c(91) = 21 - c(92) - c(93) - c(94) - c(95) - c(96)
If c(91) <> a1(1) And c(91) <> a1(2) And c(91) <> a1(3) And c(91) <> a1(4) Then GoTo 920
If c(91) = c(92) Then GoTo 920

For j90 = 1 To 4
c(90) = a1(j90)
If j90 = j95 Or j90 = j96 Then GoTo 900
c(89) = 14 - c(90) - c(95) - c(96)

For j88 = 1 To 4
c(88) = a1(j88)
If j88 = j93 Or j88 = j94 Then GoTo 880
c(87) = 14 - c(88) - c(93) - c(94)

For j86 = 1 To 4
c(86) = a1(j86)
If c(86) = c(91) Or c(86) = c(92) Then GoTo 860
c(85) = 14 - c(86) - c(91) - c(92)

For j84 = 1 To 4
c(84) = a1(j84)

c(78) = 21 - c(84) - c(90) - c(96) - c(102) - c(108)
If c(78) <> a1(1) And c(78) <> a1(2) And c(78) <> a1(3) And c(78) <> a1(4) Then GoTo 840

For j83 = 1 To 4
If j83 = j84 Then GoTo 830
c(83) = a1(j83)

c(77) = 14 - c(78) - c(83) - c(84)
If c(77) <> a1(1) And c(77) <> a1(2) And c(77) <> a1(3) And c(77) <> a1(4) Then GoTo 830

For j82 = 1 To 4
c(82) = a1(j82)

c(76) = 21 - c(82) - c(88) - c(94) - c(100) - c(106)
If c(76) <> a1(1) And c(76) <> a1(2) And c(76) <> a1(3) And c(76) <> a1(4) Then GoTo 820

For j81 = 1 To 4
If j81 = j82 Then GoTo 810
c(81) = a1(j81)

c(75) = 14 - c(76) - c(81) - c(82)
If c(75) <> a1(1) And c(75) <> a1(2) And c(75) <> a1(3) And c(75) <> a1(4) Then GoTo 810

For j80 = 1 To 4
c(80) = a1(j80)

c(79) = 21 - c(80) - c(81) - c(82) - c(83) - c(84)
If c(79) <> a1(1) And c(79) <> a1(2) And c(79) <> a1(3) And c(79) <> a1(4) Then GoTo 800
If c(79) = c(80) Then GoTo 800

c(74) = 21 - c(80) - c(86) - c(92) - c(98) - c(104)
If c(74) <> a1(1) And c(74) <> a1(2) And c(74) <> a1(3) And c(74) <> a1(4) Then GoTo 800

c(73) = 14 - c(74) - c(79) - c(80)
If c(73) <> a1(1) And c(73) <> a1(2) And c(73) <> a1(3) And c(73) <> a1(4) Then GoTo 800

i2 = 109
For i1 = 109 To 144
i2 = i2 - 1
c(i1) = 7 - c(i2)
Next i1

Cells(k1, 1).Select: Cells(k1, 1).Value = j80

' Top/Bottom Planes

For j36 = 1 To 4
c(36) = a1(j36)
For j35 = 1 To 4
If j35 = j36 Then GoTo 350
c(35) = a1(j35)
For j34 = 1 To 4
c(34) = a1(j34)
For j33 = 1 To 4
If j33 = j34 Then GoTo 330
c(33) = a1(j33)
For j32 = 1 To 4
c(32) = a1(j32)

c(31) = 21 - c(32) - c(33) - c(34) - c(35) - c(36)
If c(31) <> a1(1) And c(31) <> a1(2) And c(31) <> a1(3) And c(31) <> a1(4) Then GoTo 320
If c(31) = c(32) Then GoTo 320

For j30 = 1 To 4
c(30) = a1(j30)
If j30 = j35 Or j30 = j36 Then GoTo 300
c(29) = 14 - c(30) - c(35) - c(36)

For j28 = 1 To 4
c(28) = a1(j28)
If j28 = j33 Or j28 = j34 Then GoTo 280
c(27) = 14 - c(28) - c(33) - c(34)

For j26 = 1 To 4
c(26) = a1(j26)
If c(26) = c(31) Or c(26) = c(32) Then GoTo 260
c(25) = 14 - c(26) - c(31) - c(32)

For j24 = 1 To 4
c(24) = a1(j24)
For j23 = 1 To 4
If j23 = j24 Then GoTo 230
c(23) = a1(j23)
For j22 = 1 To 4
c(22) = a1(j22)
For j21 = 1 To 4
If j21 = j22 Then GoTo 210
c(21) = a1(j21)
For j20 = 1 To 4
c(20) = a1(j20)

c(19) = 21 - c(20) - c(21) - c(22) - c(23) - c(24)
If c(19) <> a1(1) And c(19) <> a1(2) And c(19) <> a1(3) And c(19) <> a1(4) Then GoTo 200
If c(19) = c(20) Then GoTo 200

For j18 = 1 To 4
c(18) = a1(j18)
If j18 = j23 Or j18 = j24 Then GoTo 180
c(17) = 14 - c(18) - c(23) - c(24)

For j16 = 1 To 4
c(16) = a1(j16)
If j16 = j21 Or j16 = j22 Then GoTo 160
c(15) = 14 - c(16) - c(21) - c(22)

For j14 = 1 To 4
c(14) = a1(j14)
If c(14) = c(19) Or c(14) = c(20) Then GoTo 140
c(13) = 14 - c(14) - c(19) - c(20)

For j12 = 1 To 4
c(12) = a1(j12)

c(6) = 21 - c(12) - c(18) - c(24) - c(30) - c(36)
If c(6) <> a1(1) And c(6) <> a1(2) And c(6) <> a1(3) And c(6) <> a1(4) Then GoTo 120

For j11 = 1 To 4
If j11 = j12 Then GoTo 110
c(11) = a1(j11)

c(5) = 14 - c(6) - c(11) - c(12)
If c(5) <> a1(1) And c(5) <> a1(2) And c(5) <> a1(3) And c(5) <> a1(4) Then GoTo 110

For j10 = 1 To 4
c(10) = a1(j10)

c(4) = 21 - c(10) - c(16) - c(22) - c(28) - c(34)
If c(4) <> a1(1) And c(4) <> a1(2) And c(4) <> a1(3) And c(4) <> a1(4) Then GoTo 100

For j9 = 1 To 4
If j9 = j10 Then GoTo 90
c(9) = a1(j9)

c(3) = 14 - c(4) - c(9) - c(10)
If c(3) <> a1(1) And c(3) <> a1(2) And c(3) <> a1(3) And c(3) <> a1(4) Then GoTo 90

For j8 = 1 To 4
c(8) = a1(j8)

c(7) = 21 - c(8) - c(9) - c(10) - c(11) - c(12)
If c(7) <> a1(1) And c(7) <> a1(2) And c(7) <> a1(3) And c(7) <> a1(4) Then GoTo 80
If c(7) = c(8) Then GoTo 80

c(2) = 21 - c(8) - c(14) - c(20) - c(26) - c(32)
If c(2) <> a1(1) And c(2) <> a1(2) And c(2) <> a1(3) And c(2) <> a1(4) Then GoTo 80

c(1) = 14 - c(2) - c(7) - c(8)
If c(1) <> a1(1) And c(1) <> a1(2) And c(1) <> a1(3) And c(1) <> a1(4) Then GoTo 80

i2 = 37
For i1 = 181 To 216
i2 = i2 - 1
c(i1) = 7 - c(i2)
Next i1

'  Remaining Planes

For j72 = 5 To 8
c(72) = a1(j72)
For j71 = 5 To 8
If j71 = j72 Then GoTo 710
c(71) = a1(j71)
For j66 = 5 To 8
If j66 = j71 Or j66 = j72 Then GoTo 660
c(66) = a1(j66)

c(65) = 14 - c(66) - c(71) - c(72)

c(173) = 21 - c(209) - c(137) - c(101) - c(65) - c(29)
If c(173) <> a1(1) And c(173) <> a1(2) And c(173) <> a1(3) And c(173) <> a1(4) Then GoTo 660

c(174) = 21 - c(210) - c(138) - c(102) - c(66) - c(30)
If c(174) <> a1(1) And c(174) <> a1(2) And c(174) <> a1(3) And c(174) <> a1(4) Then GoTo 660
If c(174) = c(173) Then GoTo 660

c(179) = 21 - c(215) - c(143) - c(107) - c(71) - c(35)
If c(179) <> a1(1) And c(179) <> a1(2) And c(179) <> a1(3) And c(179) <> a1(4) Then GoTo 660
If c(179) = c(174) Or c(179) = c(173) Then GoTo 660

c(180) = 21 - c(216) - c(144) - c(108) - c(72) - c(36)
If c(180) <> a1(1) And c(180) <> a1(2) And c(180) <> a1(3) And c(180) <> a1(4) Then GoTo 660
If c(180) = c(179) Or c(180) = c(174) Or c(180) = c(173) Then GoTo 660

c(145) = 7 - c(72): c(146) = 7 - c(71):
c(151) = 7 - c(66): c(152) = 7 - c(65):

c(37) = 21 - c(181) - c(109) - c(73) - c(145) - c(1)
If c(37) <> a1(5) And c(37) <> a1(6) And c(37) <> a1(7) And c(37) <> a1(8) Then GoTo 660

c(38) = 21 - c(182) - c(110) - c(74) - c(146) - c(2)
If c(38) <> a1(5) And c(38) <> a1(6) And c(38) <> a1(7) And c(38) <> a1(8) Then GoTo 660
If c(38) = c(37) Then GoTo 660

c(43) = 21 - c(187) - c(115) - c(79) - c(151) - c(7)
If c(43) <> a1(5) And c(43) <> a1(6) And c(43) <> a1(7) And c(43) <> a1(8) Then GoTo 660
If c(43) = c(38) Or c(43) = c(37) Then GoTo 660

c(44) = 21 - c(188) - c(116) - c(80) - c(152) - c(8)
If c(44) <> a1(5) And c(44) <> a1(6) And c(44) <> a1(7) And c(44) <> a1(8) Then GoTo 660
If c(44) = c(43) Or c(44) = c(38) Or c(44) = c(37) Then GoTo 660

For j48 = 5 To 8
c(48) = a1(j48)
For j47 = 5 To 8
If j47 = j48 Then GoTo 470
c(47) = a1(j47)
For j42 = 5 To 8
If j42 = j47 Or j42 = j48 Then GoTo 420
c(42) = a1(j42)

c(41) = 14 - c(42) - c(47) - c(48)

c(169) = 7 - c(48): c(170) = 7 - c(47):
c(175) = 7 - c(42): c(176) = 7 - c(41):

c(61) = 21 - c(205) - c(133) - c(97) - c(169) - c(25)
If c(61) <> a1(5) And c(61) <> a1(6) And c(61) <> a1(7) And c(61) <> a1(8) Then GoTo 420

c(62) = 21 - c(206) - c(134) - c(98) - c(170) - c(26)
If c(62) <> a1(5) And c(62) <> a1(6) And c(62) <> a1(7) And c(62) <> a1(8) Then GoTo 420
If c(62) = c(61) Then GoTo 420

c(67) = 21 - c(211) - c(139) - c(103) - c(175) - c(31)
If c(67) <> a1(5) And c(67) <> a1(6) And c(67) <> a1(7) And c(67) <> a1(8) Then GoTo 420
If c(67) = c(62) Or c(67) = c(61) Then GoTo 420

c(68) = 21 - c(212) - c(140) - c(104) - c(176) - c(32)
If c(68) <> a1(5) And c(68) <> a1(6) And c(68) <> a1(7) And c(68) <> a1(8) Then GoTo 420
If c(68) = c(67) Or c(68) = c(62) Or c(68) = c(61) Then GoTo 420

c(150) = 7 - c(67): c(149) = 7 - c(68):
c(156) = 7 - c(61): c(155) = 7 - c(62):

For j70 = 5 To 8
c(70) = a1(j70)

c(69) = 21 - c(67) - c(68) - c(70) - c(71) - c(72)
If c(69) <> a1(5) And c(69) <> a1(6) And c(69) <> a1(7) And c(69) <> a1(8) Then GoTo 700

For j64 = 5 To 8
c(64) = a1(j64)
If c(64) = c(69) Or c(64) = c(70) Then GoTo 640

c(63) = 21 - c(61) - c(62) - c(64) - c(65) - c(66)
If c(63) <> a1(5) And c(63) <> a1(6) And c(63) <> a1(7) And c(63) <> a1(8) Then GoTo 640
If c(63) = c(64) Or c(63) = c(69) Or c(63) = c(70) Then GoTo 640

c(147) = 7 - c(70):     c(148) = 7 - c(69):
c(153) = 7 - c(64):     c(154) = 7 - c(63):

c(39) = 21 - c(183) - c(111) - c(75) - c(147) - c(3)
If c(39) <> a1(5) And c(39) <> a1(6) And c(39) <> a1(7) And c(39) <> a1(8) Then GoTo 640

c(40) = 21 - c(184) - c(112) - c(76) - c(148) - c(4)
If c(40) <> a1(5) And c(40) <> a1(6) And c(40) <> a1(7) And c(40) <> a1(8) Then GoTo 640
If c(40) = c(39) Then GoTo 640

c(45) = 21 - c(189) - c(117) - c(81) - c(153) - c(9)
If c(45) <> a1(5) And c(45) <> a1(6) And c(45) <> a1(7) And c(45) <> a1(8) Then GoTo 640
If c(45) = c(40) Or c(45) = c(39) Then GoTo 640

c(46) = 21 - c(190) - c(118) - c(82) - c(154) - c(10)
If c(46) <> a1(5) And c(46) <> a1(6) And c(46) <> a1(7) And c(46) <> a1(8) Then GoTo 640
If c(46) = c(45) Or c(46) = c(40) Or c(46) = c(39) Then GoTo 640

c(171) = 7 - c(46):     c(172) = 7 - c(45):
c(177) = 7 - c(40):     c(178) = 7 - c(39):

For j60 = 5 To 8
c(60) = a1(j60)

c(54) = 21 - c(42) - c(48) - c(60) - c(66) - c(72)
If c(54) <> a1(5) And c(54) <> a1(6) And c(54) <> a1(7) And c(54) <> a1(8) Then GoTo 600
If c(54) = c(60) Then GoTo 600

For j59 = 5 To 8
c(59) = a1(j59)
If c(59) = c(54) Or c(59) = c(60) Then GoTo 590

c(53) = 21 - c(41) - c(47) - c(59) - c(65) - c(71)
If c(53) <> a1(5) And c(53) <> a1(6) And c(53) <> a1(7) And c(53) <> a1(8) Then GoTo 590
If c(53) = c(54) Or c(53) = c(59) Or c(53) = c(60) Then GoTo 590

c(157) = 7 - c(60):     c(158) = 7 - c(59):
c(163) = 7 - c(54):     c(164) = 7 - c(53):

c(161) = 21 - c(197) - c(125) - c(89) - c(53) - c(17)
If c(161) <> a1(1) And c(161) <> a1(2) And c(161) <> a1(3) And c(161) <> a1(4) Then GoTo 590

c(162) = 21 - c(198) - c(126) - c(90) - c(54) - c(18)
If c(162) <> a1(1) And c(162) <> a1(2) And c(162) <> a1(3) And c(162) <> a1(4) Then GoTo 590
If c(162) = c(161) Then GoTo 590

c(167) = 21 - c(203) - c(131) - c(95) - c(59) - c(23)
If c(167) <> a1(1) And c(167) <> a1(2) And c(167) <> a1(3) And c(167) <> a1(4) Then GoTo 590
If c(167) = c(161) Or c(167) = c(162) Then GoTo 590

c(168) = 21 - c(204) - c(132) - c(96) - c(60) - c(24)
If c(168) <> a1(1) And c(168) <> a1(2) And c(168) <> a1(3) And c(168) <> a1(4) Then GoTo 590
If c(168) = c(161) Or c(168) = c(162) Or c(168) = c(167) Then GoTo 590

c(49) = 7 - c(168):     c(50) = 7 - c(167):
c(55) = 7 - c(162):     c(56) = 7 - c(161):

For j58 = 5 To 8
c(58) = a1(j58)

c(52) = 21 - c(40) - c(46) - c(58) - c(64) - c(70)
If c(52) <> a1(5) And c(52) <> a1(6) And c(52) <> a1(7) And c(52) <> a1(8) Then GoTo 580
If c(52) = c(58) Then GoTo 580

c(160) = 21 - c(196) - c(124) - c(88) - c(52) - c(16)
If c(160) <> a1(1) And c(160) <> a1(2) And c(160) <> a1(3) And c(160) <> a1(4) Then GoTo 580

c(166) = 21 - c(202) - c(130) - c(94) - c(58) - c(22)
If c(166) <> a1(1) And c(166) <> a1(2) And c(166) <> a1(3) And c(166) <> a1(4) Then GoTo 580
If c(166) = c(160) Then GoTo 580

c(51) = 21 - c(49) - c(50) - c(52) - c(53) - c(54)
If c(51) <> a1(5) And c(51) <> a1(6) And c(51) <> a1(7) And c(51) <> a1(8) Then GoTo 580
If c(51) = c(52) Or c(51) = c(58) Then GoTo 580

c(57) = 14 - c(51) - c(52) - c(58)

c(159) = 7 - c(58): c(165) = 7 - c(52)

MC6 = 21: GoSub 2000: If fl1 = 0 Then GoTo 580  'Back Check Trenkler Cube

GoSub 2800                                      'Contruct Simple Magic Cube
GoSub 2850: If fl1 = 0 Then GoTo 580            'Back Check Identical Numbers

n9 = n9 + 1: GoSub 2750                         'Print Cube (6 Plane Format)

580 Next j58
590 Next j59
600 Next j60

640 Next j64
700 Next j70

420 Next j42
470 Next j47
480 Next j48

660 Next j66
710 Next j71
720 Next j72

80 Next j8
90 Next j9
100 Next j10
110 Next j11
120 Next j12

140 Next j14
160 Next j16
180 Next j18

200 Next j20
210 Next j21
220 Next j22
230 Next j23
240 Next j24

260 Next j26
280 Next j28
300 Next j30

320 Next j32
330 Next j33
340 Next j34
350 Next j35
360 Next j36

800 Next j80
810 Next j81
820 Next j82
830 Next j83
840 Next j84

860 Next j86
880 Next j88
900 Next j90

920 Next j92
930 Next j93
940 Next j94
950 Next j95
960 Next j96

980  Next j98
1000 Next j100
1020 Next j102

1040 Next j104
1050 Next j105
1060 Next j106
1070 Next j107
1080 Next j108

t2 = Timer

t10 = Str(t2 - t1) + " sec., " + Str(n9) + " Solutions"
y = MsgBox(t10, 0, "Routine MgcCube6b")

End

'    Print Cubes (6 plane format)

2750 n2 = n2 + 1
If n2 = 5 Then
n2 = 1: k1 = k1 + 42: k2 = 1
Else
If n9 > 1 Then k2 = k2 + 7
End If

Cells(k1, k2 + 1).Select
Cells(k1, k2 + 1).Font.Color = -4165632
Cells(k1, k2 + 1).Value = n9

For i0 = 1 To 6
i3 = (6 - i0) * 36
For i1 = 1 To 6
For i2 = 1 To 6
i3 = i3 + 1
'                Cells(k1 + i1 + (i0 - 1) * 7, k2 + i2).Value = c(i3)   'Trenkler Cube
Cells(k1 + i1 + (i0 - 1) * 7, k2 + i2).Value = a(i3)   'Associated Magic Cube
Next i2
Next i1
Next i0

Return

'    Back Check Magic Constant

2000 fl1 = 1

'   Rows

i1 = -5
For i0 = 1 To 36
i1 = i1 + 6
b(1) = c(i1): b(2) = c(i1 + 1): b(3) = c(i1 + 2): b(4) = c(i1 + 3): b(5) = c(i1 + 4): b(6) = c(i1 + 5)
GoSub 2860
If fl1 = 0 Then Return
Next i0

'   Columns

i1 = 0: i2 = 0
For i0 = 1 To 36
i1 = i1 + 1
b(1) = c(i1): b(2) = c(i1 + 6): b(3) = c(i1 + 12): b(4) = c(i1 + 18): b(5) = c(i1 + 24): b(6) = c(i1 + 30)
i2 = i2 + 1: If i2 = 6 Then i2 = 0: i1 = i1 + 30
GoSub 2860
If fl1 = 0 Then Return
Next i0

'   Pillars

i1 = 0: i2 = 0
For i0 = 1 To 36
i1 = i0
b(1) = c(i1): b(2) = c(i1 + 36): b(3) = c(i1 + 72): b(4) = c(i1 + 108): b(5) = c(i1 + 144): b(6) = c(i1 + 180)
GoSub 2860
If fl1 = 0 Then Return
Next i0

'   Accociated Pairs

For i1 = 1 To 108
s2 = c(i1) + c(216 + 1 - i1)
If s2 <> 7 Then fl1 = 0: Return
Next i1

Return

'   Check MC6

2860 fl1 = 1
If b(1) + b(2) + b(3) + b(4) + b(5) + b(6) <> MC6 Then fl1 = 0
Return

'    Calculate Simple Magic Cubes

2800

a(181) = b1(19) + 27 * c(181): a(182) = b1(19) + 27 * c(182): a(183) = b1(20) + 27 * c(183):
a(187) = b1(19) + 27 * c(187): a(188) = b1(19) + 27 * c(188): a(189) = b1(20) + 27 * c(189):
a(193) = b1(22) + 27 * c(193): a(194) = b1(22) + 27 * c(194): a(195) = b1(23) + 27 * c(195):
a(199) = b1(22) + 27 * c(199): a(200) = b1(22) + 27 * c(200): a(201) = b1(23) + 27 * c(201):
a(205) = b1(25) + 27 * c(205): a(206) = b1(25) + 27 * c(206): a(207) = b1(26) + 27 * c(207):
a(211) = b1(25) + 27 * c(211): a(212) = b1(25) + 27 * c(212): a(213) = b1(26) + 27 * c(213):

a(184) = b1(20) + 27 * c(184): a(185) = b1(21) + 27 * c(185): a(186) = b1(21) + 27 * c(186):
a(190) = b1(20) + 27 * c(190): a(191) = b1(21) + 27 * c(191): a(192) = b1(21) + 27 * c(192):
a(196) = b1(23) + 27 * c(196): a(197) = b1(24) + 27 * c(197): a(198) = b1(24) + 27 * c(198):
a(202) = b1(23) + 27 * c(202): a(203) = b1(24) + 27 * c(203): a(204) = b1(24) + 27 * c(204):
a(208) = b1(26) + 27 * c(208): a(209) = b1(27) + 27 * c(209): a(210) = b1(27) + 27 * c(210):
a(214) = b1(26) + 27 * c(214): a(215) = b1(27) + 27 * c(215): a(216) = b1(27) + 27 * c(216):

a(145) = b1(19) + 27 * c(145): a(146) = b1(19) + 27 * c(146): a(147) = b1(20) + 27 * c(147):
a(151) = b1(19) + 27 * c(151): a(152) = b1(19) + 27 * c(152): a(153) = b1(20) + 27 * c(153):
a(157) = b1(22) + 27 * c(157): a(158) = b1(22) + 27 * c(158): a(159) = b1(23) + 27 * c(159):
a(163) = b1(22) + 27 * c(163): a(164) = b1(22) + 27 * c(164): a(165) = b1(23) + 27 * c(165):
a(169) = b1(25) + 27 * c(169): a(170) = b1(25) + 27 * c(170): a(171) = b1(26) + 27 * c(171):
a(175) = b1(25) + 27 * c(175): a(176) = b1(25) + 27 * c(176): a(177) = b1(26) + 27 * c(177):

a(148) = b1(20) + 27 * c(148): a(149) = b1(21) + 27 * c(149): a(150) = b1(21) + 27 * c(150):
a(154) = b1(20) + 27 * c(154): a(155) = b1(21) + 27 * c(155): a(156) = b1(21) + 27 * c(156):
a(160) = b1(23) + 27 * c(160): a(161) = b1(24) + 27 * c(161): a(162) = b1(24) + 27 * c(162):
a(166) = b1(23) + 27 * c(166): a(167) = b1(24) + 27 * c(167): a(168) = b1(24) + 27 * c(168):
a(172) = b1(26) + 27 * c(172): a(173) = b1(27) + 27 * c(173): a(174) = b1(27) + 27 * c(174):
a(178) = b1(26) + 27 * c(178): a(179) = b1(27) + 27 * c(179): a(180) = b1(27) + 27 * c(180):

a(109) = b1(10) + 27 * c(109): a(110) = b1(10) + 27 * c(110): a(111) = b1(11) + 27 * c(111):
a(115) = b1(10) + 27 * c(115): a(116) = b1(10) + 27 * c(116): a(117) = b1(11) + 27 * c(117):
a(121) = b1(13) + 27 * c(121): a(122) = b1(13) + 27 * c(122): a(123) = b1(14) + 27 * c(123):
a(127) = b1(13) + 27 * c(127): a(128) = b1(13) + 27 * c(128): a(129) = b1(14) + 27 * c(129):
a(133) = b1(16) + 27 * c(133): a(134) = b1(16) + 27 * c(134): a(135) = b1(17) + 27 * c(135):
a(139) = b1(16) + 27 * c(139): a(140) = b1(16) + 27 * c(140): a(141) = b1(17) + 27 * c(141):

a(112) = b1(11) + 27 * c(112): a(113) = b1(12) + 27 * c(113): a(114) = b1(12) + 27 * c(114):
a(118) = b1(11) + 27 * c(118): a(119) = b1(12) + 27 * c(119): a(120) = b1(12) + 27 * c(120):
a(124) = b1(14) + 27 * c(124): a(125) = b1(15) + 27 * c(125): a(126) = b1(15) + 27 * c(126):
a(130) = b1(14) + 27 * c(130): a(131) = b1(15) + 27 * c(131): a(132) = b1(15) + 27 * c(132):
a(136) = b1(17) + 27 * c(136): a(137) = b1(18) + 27 * c(137): a(138) = b1(18) + 27 * c(138):
a(142) = b1(17) + 27 * c(142): a(143) = b1(18) + 27 * c(143): a(144) = b1(18) + 27 * c(144):

a(73) = b1(10) + 27 * c(73):   a(74) = b1(10) + 27 * c(74):   a(75) = b1(11) + 27 * c(75):
a(79) = b1(10) + 27 * c(79):   a(80) = b1(10) + 27 * c(80):   a(81) = b1(11) + 27 * c(81):
a(85) = b1(13) + 27 * c(85):   a(86) = b1(13) + 27 * c(86):   a(87) = b1(14) + 27 * c(87):
a(91) = b1(13) + 27 * c(91):   a(92) = b1(13) + 27 * c(92):   a(93) = b1(14) + 27 * c(93):
a(97) = b1(16) + 27 * c(97):   a(98) = b1(16) + 27 * c(98):   a(99) = b1(17) + 27 * c(99):
a(103) = b1(16) + 27 * c(103): a(104) = b1(16) + 27 * c(104): a(105) = b1(17) + 27 * c(105):

a(76) = b1(11) + 27 * c(76):   a(77) = b1(12) + 27 * c(77):   a(78) = b1(12) + 27 * c(78):
a(82) = b1(11) + 27 * c(82):   a(83) = b1(12) + 27 * c(83):   a(84) = b1(12) + 27 * c(84):
a(88) = b1(14) + 27 * c(88):   a(89) = b1(15) + 27 * c(89):   a(90) = b1(15) + 27 * c(90):
a(94) = b1(14) + 27 * c(94):   a(95) = b1(15) + 27 * c(95):   a(96) = b1(15) + 27 * c(96):
a(100) = b1(17) + 27 * c(100): a(101) = b1(18) + 27 * c(101): a(102) = b1(18) + 27 * c(102):
a(106) = b1(17) + 27 * c(106): a(107) = b1(18) + 27 * c(107): a(108) = b1(18) + 27 * c(108):

a(37) = b1(1) + 27 * c(37):    a(38) = b1(1) + 27 * c(38):    a(39) = b1(2) + 27 * c(39):
a(43) = b1(1) + 27 * c(43):    a(44) = b1(1) + 27 * c(44):    a(45) = b1(2) + 27 * c(45):
a(49) = b1(4) + 27 * c(49):    a(50) = b1(4) + 27 * c(50):    a(51) = b1(5) + 27 * c(51):
a(55) = b1(4) + 27 * c(55):    a(56) = b1(4) + 27 * c(56):    a(57) = b1(5) + 27 * c(57):
a(61) = b1(7) + 27 * c(61):    a(62) = b1(7) + 27 * c(62):    a(63) = b1(8) + 27 * c(63):
a(67) = b1(7) + 27 * c(67):    a(68) = b1(7) + 27 * c(68):    a(69) = b1(8) + 27 * c(69):

a(40) = b1(2) + 27 * c(40):    a(41) = b1(3) + 27 * c(41):    a(42) = b1(3) + 27 * c(42):
a(46) = b1(2) + 27 * c(46):    a(47) = b1(3) + 27 * c(47):    a(48) = b1(3) + 27 * c(48):
a(52) = b1(5) + 27 * c(52):    a(53) = b1(6) + 27 * c(53):    a(54) = b1(6) + 27 * c(54):
a(58) = b1(5) + 27 * c(58):    a(59) = b1(6) + 27 * c(59):    a(60) = b1(6) + 27 * c(60):
a(64) = b1(8) + 27 * c(64):    a(65) = b1(9) + 27 * c(65):    a(66) = b1(9) + 27 * c(66):
a(70) = b1(8) + 27 * c(70):    a(71) = b1(9) + 27 * c(71):    a(72) = b1(9) + 27 * c(72):

a(1) = b1(1) + 27 * c(1):      a(2) = b1(1) + 27 * c(2):      a(3) = b1(2) + 27 * c(3):
a(7) = b1(1) + 27 * c(7):      a(8) = b1(1) + 27 * c(8):      a(9) = b1(2) + 27 * c(9):
a(13) = b1(4) + 27 * c(13):    a(14) = b1(4) + 27 * c(14):    a(15) = b1(5) + 27 * c(15):
a(19) = b1(4) + 27 * c(19):    a(20) = b1(4) + 27 * c(20):    a(21) = b1(5) + 27 * c(21):
a(25) = b1(7) + 27 * c(25):    a(26) = b1(7) + 27 * c(26):    a(27) = b1(8) + 27 * c(27):
a(31) = b1(7) + 27 * c(31):    a(32) = b1(7) + 27 * c(32):    a(33) = b1(8) + 27 * c(33):

a(4) = b1(2) + 27 * c(4):      a(5) = b1(3) + 27 * c(5):      a(6) = b1(3) + 27 * c(6):
a(10) = b1(2) + 27 * c(10):    a(11) = b1(3) + 27 * c(11):    a(12) = b1(3) + 27 * c(12):
a(16) = b1(5) + 27 * c(16):    a(17) = b1(6) + 27 * c(17):    a(18) = b1(6) + 27 * c(18):
a(22) = b1(5) + 27 * c(22):    a(23) = b1(6) + 27 * c(23):    a(24) = b1(6) + 27 * c(24):
a(28) = b1(8) + 27 * c(28):    a(29) = b1(9) + 27 * c(29):    a(30) = b1(9) + 27 * c(30):
a(34) = b1(8) + 27 * c(34):    a(35) = b1(9) + 27 * c(35):    a(36) = b1(9) + 27 * c(36):

Return

'    Check Identical Numbers (Back Check)

2850 fl1 = 1
For i1 = 1 To 216
a20 = a(i1)
For i2 = i1 + 1 To 216
If a20 = a(i2) Then fl1 = 0: Return
Next i2
Next i1

Return

End Sub
```