' Generates Perfect Concentric Magic Cubes of order 6 (Prime Numbers)
' Part I: Top Squares, Plane Symmetrical Center Square Based (a)
' Tested with Office 365 under Windows 10
Sub PrimeCubes78a()
Dim a1(724), a(216), b1(43291), b(43291), c(216), C6(216)
Dim a2(72), c2(72), d(16)
y = MsgBox("Locked", vbCritical, "Routine PrimeCubes78a")
End
n2 = 0: n9 = 0: k1 = 1: k2 = 1
ShtNm1 = "Cubes4":
ShtNm2 = "Pairs63"
Sheets("Klad1").Select
t1 = Timer
For j100 = 32 To 32
' Start reading data from ShtNm1
Rcrd1a = Sheets(ShtNm1).Cells(j100, 67).Value
s4 = Sheets(ShtNm1).Cells(j100, 65).Value
GoSub 4100 'Difine Border Integers
' Read Center Cube
For i1 = 1 To 64
a(i1) = Sheets(ShtNm1).Cells(j100, i1).Value
Next i1
GoSub 750 'Fill Center Cube c6()
' Top Square, Corner Points
For j36 = m2 / 2 To m2 'c6(36)
If b(a1(j36)) = 0 Then b(a1(j36)) = a1(j36): c(36) = a1(j36) Else GoTo 360
C6(36) = a1(j36)
C6(181) = Pr3 - C6(36): If b(C6(181)) = 0 Then b(C6(181)) = C6(181): c(181) = C6(181) Else GoTo 1810
For j31 = m2 / 2 To m2 'c6(31)
If b(a1(j31)) = 0 Then b(a1(j31)) = a1(j31): c(31) = a1(j31) Else GoTo 310
C6(31) = a1(j31)
C6(186) = Pr3 - C6(31): If b(C6(186)) = 0 Then b(C6(186)) = C6(186): c(186) = C6(186) Else GoTo 1860
For j1 = m2 / 2 To m2 'c6(1)
If b(a1(j1)) = 0 Then b(a1(j1)) = a1(j1): c(1) = a1(j1) Else GoTo 10
C6(1) = a1(j1)
C6(216) = Pr3 - C6(1): If b(C6(216)) = 0 Then b(C6(216)) = C6(216): c(216) = C6(216) Else GoTo 2160
C6(6) = s4 - C6(31) - C6(1) - C6(36)
If C6(6) < a1(m1) Or C6(6) > a1(m2) Then GoTo 60
If b1(C6(6)) = 0 Then GoTo 60
If b(C6(6)) = 0 Then b(C6(6)) = C6(6): c(6) = C6(6) Else GoTo 60
C6(211) = Pr3 - C6(6): If b(C6(211)) = 0 Then b(C6(211)) = C6(211): c(211) = C6(211) Else GoTo 2110
' Top Square, Border
For j35 = m1 To m2 'c6(35)
If b(a1(j35)) = 0 Then b(a1(j35)) = a1(j35): c(35) = a1(j35) Else GoTo 350
C6(35) = a1(j35)
C6(185) = s6 - d(8) - C6(35):
If C6(185) < a1(m1) Or C6(185) > a1(m2) Then GoTo 1850
If b1(C6(185)) = 0 Then GoTo 1850
If b(C6(185)) = 0 Then b(C6(185)) = C6(185): c(185) = C6(185) Else GoTo 1850
C6(5) = s6 / 3 - C6(35): If b(a(5)) = 0 Then b(a(5)) = a(5): c(5) = a(5) Else GoTo 50
C6(215) = s6 - d(4) - C6(5):
If C6(215) < a1(m1) Or C6(215) > a1(m2) Then GoTo 2150
If b1(C6(215)) = 0 Then GoTo 2150
If b(C6(215)) = 0 Then b(C6(215)) = C6(215): c(215) = C6(215) Else GoTo 2150
For j34 = m1 To m2 'c6(34)
If b(a1(j34)) = 0 Then b(a1(j34)) = a1(j34): c(34) = a1(j34) Else GoTo 340
C6(34) = a1(j34)
C6(184) = s6 - d(7) - C6(34):
If C6(184) < a1(m1) Or C6(184) > a1(m2) Then GoTo 1840
If b1(C6(184)) = 0 Then GoTo 1840
If b(C6(184)) = 0 Then b(C6(184)) = C6(184): c(184) = C6(184) Else GoTo 1840
C6(4) = s6 / 3 - C6(34): If b(a(4)) = 0 Then b(a(4)) = a(4): c(4) = a(4) Else GoTo 40
C6(214) = s6 - d(3) - C6(4):
If C6(214) < a1(m1) Or C6(214) > a1(m2) Then GoTo 2140
If b1(C6(214)) = 0 Then GoTo 2140
If b(C6(214)) = 0 Then b(C6(214)) = C6(214): c(214) = C6(214) Else GoTo 2140
For j33 = m1 To m2 'c6(33)
If b(a1(j33)) = 0 Then b(a1(j33)) = a1(j33): c(33) = a1(j33) Else GoTo 330
C6(33) = a1(j33)
C6(183) = s6 - d(6) - C6(33):
If C6(183) < a1(m1) Or C6(183) > a1(m2) Then GoTo 1830
If b1(C6(183)) = 0 Then GoTo 1830
If b(C6(183)) = 0 Then b(C6(183)) = C6(183): c(183) = C6(183) Else GoTo 1830
C6(3) = s6 / 3 - C6(33): If b(a(3)) = 0 Then b(a(3)) = a(3): c(3) = a(3) Else GoTo 30
C6(213) = s6 - d(2) - C6(3):
If C6(213) < a1(m1) Or C6(213) > a1(m2) Then GoTo 2130
If b1(C6(213)) = 0 Then GoTo 2130
If b(C6(213)) = 0 Then b(C6(213)) = C6(213): c(213) = C6(213) Else GoTo 2130
C6(32) = s6 - C6(33) - C6(34) - C6(35) - C6(31) - C6(36)
If C6(32) < a1(m1) Or C6(32) > a1(m2) Then GoTo 320
If b1(C6(32)) = 0 Then GoTo 320
If b(C6(32)) = 0 Then b(C6(32)) = C6(32): c(32) = C6(32) Else GoTo 320
C6(182) = s6 - d(5) - C6(32):
If C6(182) < a1(m1) Or C6(182) > a1(m2) Then GoTo 1820
If b1(C6(182)) = 0 Then GoTo 1820
If b(C6(182)) = 0 Then b(C6(182)) = C6(182): c(182) = C6(182) Else GoTo 1820
C6(2) = s6 / 3 - C6(32): If b(a(2)) = 0 Then b(a(2)) = a(2): c(2) = a(2) Else GoTo 20
C6(212) = s6 - d(1) - C6(2):
If C6(212) < a1(m1) Or C6(212) > a1(m2) Then GoTo 2120
If b1(C6(212)) = 0 Then GoTo 2120
If b(C6(212)) = 0 Then b(C6(212)) = C6(212): c(212) = C6(212) Else GoTo 2120
For j30 = m1 To m2 'c6(30)
If b(a1(j30)) = 0 Then b(a1(j30)) = a1(j30): c(30) = a1(j30) Else GoTo 300
C6(30) = a1(j30)
C6(205) = s6 - d(16) - C6(30):
If C6(205) < a1(m1) Or C6(205) > a1(m2) Then GoTo 2050
If b1(C6(205)) = 0 Then GoTo 2050
If b(C6(205)) = 0 Then b(C6(205)) = C6(205): c(205) = C6(205) Else GoTo 2050
C6(25) = s6 / 3 - C6(30): If b(a(25)) = 0 Then b(a(25)) = a(25): c(25) = a(25) Else GoTo 250
C6(210) = s6 - d(12) - C6(25):
If C6(210) < a1(m1) Or C6(210) > a1(m2) Then GoTo 2100
If b1(C6(210)) = 0 Then GoTo 2100
If b(C6(210)) = 0 Then b(C6(210)) = C6(210): c(210) = C6(210) Else GoTo 2100
For j24 = m1 To m2 'c6(24)
If b(a1(j24)) = 0 Then b(a1(j24)) = a1(j24): c(24) = a1(j24) Else GoTo 240
C6(24) = a1(j24)
C6(199) = s6 - d(15) - C6(24):
If C6(199) < a1(m1) Or C6(199) > a1(m2) Then GoTo 1990
If b1(C6(199)) = 0 Then GoTo 1990
If b(C6(199)) = 0 Then b(C6(199)) = C6(199): c(199) = C6(199) Else GoTo 1990
C6(19) = s6 / 3 - C6(24): If b(a(19)) = 0 Then b(a(19)) = a(19): c(19) = a(19) Else GoTo 190
C6(204) = s6 - d(11) - C6(19):
If C6(204) < a1(m1) Or C6(204) > a1(m2) Then GoTo 2040
If b1(C6(204)) = 0 Then GoTo 2040
If b(C6(204)) = 0 Then b(C6(204)) = C6(204): c(204) = C6(204) Else GoTo 2040
For j18 = m1 To m2 'c6(18)
If b(a1(j18)) = 0 Then b(a1(j18)) = a1(j18): c(18) = a1(j18) Else GoTo 180
C6(18) = a1(j18)
C6(193) = s6 - d(14) - C6(18):
If C6(193) < a1(m1) Or C6(193) > a1(m2) Then GoTo 1930
If b1(C6(193)) = 0 Then GoTo 1930
If b(C6(193)) = 0 Then b(C6(193)) = C6(193): c(193) = C6(193) Else GoTo 1930
C6(13) = s6 / 3 - C6(18): If b(a(13)) = 0 Then b(a(13)) = a(13): c(13) = a(13) Else GoTo 130
C6(198) = s6 - d(10) - C6(13):
If C6(198) < a1(m1) Or C6(198) > a1(m2) Then GoTo 1980
If b1(C6(198)) = 0 Then GoTo 1980
If b(C6(189)) = 0 Then b(C6(189)) = C6(189): c(189) = C6(189) Else GoTo 1890
C6(12) = s6 - C6(18) - C6(24) - C6(30) - C6(6) - C6(36)
If C6(12) < a1(m1) Or C6(12) > a1(m2) Then GoTo 120
If b1(C6(12)) = 0 Then GoTo 120
If b(C6(12)) = 0 Then b(C6(12)) = C6(12): c(12) = C6(12) Else GoTo 120
C6(187) = s6 - d(13) - C6(12):
If C6(187) < a1(m1) Or C6(187) > a1(m2) Then GoTo 1870
If b1(C6(187)) = 0 Then GoTo 1870
If b(C6(187)) = 0 Then b(C6(187)) = C6(187): c(187) = C6(187) Else GoTo 1870
C6(7) = s6 / 3 - C6(12): If b(a(7)) = 0 Then b(a(7)) = a(7): c(7) = a(7) Else GoTo 70
C6(192) = s6 - d(9) - C6(7):
If C6(192) < a1(m1) Or C6(192) > a1(m2) Then GoTo 1920
If b1(C6(192)) = 0 Then GoTo 1920
If b(C6(192)) = 0 Then b(C6(192)) = C6(192): c(192) = C6(192) Else GoTo 1920
' Border Completed
For j29 = m1 To m2 'c6(29)
If b(a1(j29)) = 0 Then b(a1(j29)) = a1(j29): c(29) = a1(j29) Else GoTo 290
C6(29) = a1(j29)
C6(209) = Pr3 - C6(29): If b(C6(209)) = 0 Then b(C6(209)) = C6(209): c(209) = C6(209) Else GoTo 2090
For j22 = m1 To m2 'c6(22)
If b(a1(j22)) = 0 Then b(a1(j22)) = a1(j22): c(22) = a1(j22) Else GoTo 220
C6(22) = a1(j22)
C6(202) = Pr3 - C6(22): If b(C6(202)) = 0 Then b(C6(202)) = C6(202): c(202) = C6(202) Else GoTo 2020
For j15 = m1 To m2 'c6(15)
If b(a1(j15)) = 0 Then b(a1(j15)) = a1(j15): c(15) = a1(j15) Else GoTo 150
C6(15) = a1(j15)
C6(195) = Pr3 - C6(15): If b(C6(195)) = 0 Then b(C6(195)) = C6(195): c(195) = C6(195) Else GoTo 1950
C6(8) = s6 - C6(15) - C6(22) - C6(29) - C6(1) - C6(36)
If C6(8) < a1(m1) Or C6(8) > a1(m2) Then GoTo 80
If b1(C6(8)) = 0 Then GoTo 80
If b(C6(8)) = 0 Then b(C6(8)) = C6(8): c(8) = C6(8) Else GoTo 80
C6(188) = Pr3 - C6(8): If b(C6(188)) = 0 Then b(C6(188)) = C6(188): c(188) = C6(188) Else GoTo 1880
For j26 = m1 To m2 'c6(26)
If b(a1(j26)) = 0 Then b(a1(j26)) = a1(j26): c(26) = a1(j26) Else GoTo 260
C6(26) = a1(j26)
C6(206) = Pr3 - C6(26): If b(C6(206)) = 0 Then b(C6(206)) = C6(206): c(206) = C6(206) Else GoTo 2060
For j21 = m1 To m2 'c6(21)
If b(a1(j21)) = 0 Then b(a1(j21)) = a1(j21): c(21) = a1(j21) Else GoTo 210
C6(21) = a1(j21)
C6(201) = Pr3 - C6(21): If b(C6(201)) = 0 Then b(C6(201)) = C6(201): c(201) = C6(201) Else GoTo 2010
C6(16) = s4 - C6(21) - C6(15) - C6(22)
If C6(16) < a1(m1) Or C6(16) > a1(m2) Then GoTo 160
If b1(C6(16)) = 0 Then GoTo 160
If b(C6(16)) = 0 Then b(C6(16)) = C6(16): c(16) = C6(16) Else GoTo 160
C6(196) = Pr3 - C6(16): If b(C6(196)) = 0 Then b(C6(196)) = C6(196): c(196) = C6(196) Else GoTo 1960
C6(11) = s6 - C6(16) - C6(21) - C6(26) - C6(6) - C6(31)
If C6(11) < a1(m1) Or C6(11) > a1(m2) Then GoTo 110
If b1(C6(11)) = 0 Then GoTo 110
If b(C6(11)) = 0 Then b(C6(11)) = C6(11): c(11) = C6(11) Else GoTo 110
C6(191) = Pr3 - C6(11): If b(C6(191)) = 0 Then b(C6(191)) = C6(191): c(191) = C6(191) Else GoTo 1910
For j28 = m1 To m2 'c6(28)
If b(a1(j28)) = 0 Then b(a1(j28)) = a1(j28): c(28) = a1(j28) Else GoTo 280
C6(28) = a1(j28)
C6(208) = Pr3 - C6(28): If b(C6(208)) = 0 Then b(C6(208)) = C6(208): c(208) = C6(208) Else GoTo 2080
C6(27) = s4 - C6(28) - C6(26) - C6(29)
If C6(27) < a1(m1) Or C6(27) > a1(m2) Then GoTo 270
If b1(C6(27)) = 0 Then GoTo 270
If b(C6(27)) = 0 Then b(C6(27)) = C6(27): c(27) = C6(27) Else GoTo 270
C6(207) = Pr3 - C6(27): If b(C6(207)) = 0 Then b(C6(207)) = C6(207): c(207) = C6(207) Else GoTo 2070
C6(10) = s6 - C6(28) - C6(16) - C6(22) - C6(4) - C6(34)
If C6(10) < a1(m1) Or C6(10) > a1(m2) Then GoTo 100
If b1(C6(10)) = 0 Then GoTo 100
If b(C6(10)) = 0 Then b(C6(10)) = C6(10): c(10) = C6(10) Else GoTo 100
C6(190) = Pr3 - C6(10): If b(C6(190)) = 0 Then b(C6(190)) = C6(190): c(190) = C6(190) Else GoTo 1900
C6(9) = s4 - C6(10) - C6(11) - C6(8)
If C6(9) < a1(m1) Or C6(9) > a1(m2) Then GoTo 90
If b1(C6(9)) = 0 Then GoTo 90
If b(C6(9)) = 0 Then b(C6(9)) = C6(9): c(9) = C6(9) Else GoTo 90
C6(189) = Pr3 - C6(9): If b(C6(189)) = 0 Then b(C6(189)) = C6(189): c(189) = C6(189) Else GoTo 1890
For j23 = m1 To m2 'c6(23)
If b(a1(j23)) = 0 Then b(a1(j23)) = a1(j23): c(23) = a1(j23) Else GoTo 230
C6(23) = a1(j23)
C6(203) = Pr3 - C6(23): If b(C6(203)) = 0 Then b(C6(203)) = C6(203): c(203) = C6(203) Else GoTo 2030
C6(20) = s4 - C6(23) - C6(21) - C6(22)
If C6(20) < a1(m1) Or C6(20) > a1(m2) Then GoTo 200
If b1(C6(20)) = 0 Then GoTo 200
If b(C6(20)) = 0 Then b(C6(20)) = C6(20): c(20) = C6(20) Else GoTo 200
C6(200) = Pr3 - C6(20): If b(C6(200)) = 0 Then b(C6(200)) = C6(200): c(200) = C6(200) Else GoTo 2000
C6(17) = s4 - C6(23) - C6(11) - C6(29)
If C6(17) < a1(m1) Or C6(17) > a1(m2) Then GoTo 170
If b1(C6(17)) = 0 Then GoTo 170
If b(C6(17)) = 0 Then b(C6(17)) = C6(17): c(17) = C6(17) Else GoTo 170
C6(197) = Pr3 - C6(17): If b(C6(197)) = 0 Then b(C6(197)) = C6(197): c(197) = C6(197) Else GoTo 1970
C6(14) = s4 - C6(20) - C6(26) - C6(8)
If C6(14) < a1(m1) Or C6(14) > a1(m2) Then GoTo 140
If b1(C6(14)) = 0 Then GoTo 140
If b(C6(14)) = 0 Then b(C6(14)) = C6(14): c(14) = C6(14) Else GoTo 140
C6(194) = Pr3 - C6(14): If b(C6(194)) = 0 Then b(C6(194)) = C6(194): c(194) = C6(194) Else GoTo 1940
' Exclude solutions with identical numbers c6 (Back Check)
GoSub 850: If fl1 = 0 Then GoTo 5
'' n9 = n9 + 1: GoSub 2750 'Print c6(), Cube Format
n9 = n9 + 1: GoSub 2650 'Print c6(), Line Format
Erase b, c: GoTo 1000 'Print only first Cube
5
b(c(194)) = 0: c(194) = 0
1940 b(c(14)) = 0: c(14) = 0
140 b(c(197)) = 0: c(197) = 0
1970 b(c(17)) = 0: c(17) = 0
170 b(c(200)) = 0: c(200) = 0
2000 b(c(20)) = 0: c(20) = 0
200 b(c(203)) = 0: c(203) = 0
2030 b(c(23)) = 0: c(23) = 0
230 Next j23
b(c(189)) = 0: c(189) = 0
1890 b(c(9)) = 0: c(9) = 0
90 b(c(190)) = 0: c(190) = 0
1900 b(c(10)) = 0: c(10) = 0
100 b(c(207)) = 0: c(207) = 0
2070 b(c(27)) = 0: c(27) = 0
270 b(c(208)) = 0: c(208) = 0
2080 b(c(28)) = 0: c(28) = 0
280 Next j28
b(c(191)) = 0: c(191) = 0
1910 b(c(11)) = 0: c(11) = 0
110 b(c(196)) = 0: c(196) = 0
1960 b(c(16)) = 0: c(16) = 0
160 b(c(201)) = 0: c(201) = 0
2010 b(c(21)) = 0: c(21) = 0
210 Next j21
b(c(206)) = 0: c(206) = 0
2060 b(c(26)) = 0: c(26) = 0
260 Next j26
b(c(188)) = 0: c(188) = 0
1880 b(c(8)) = 0: c(8) = 0
80 b(c(195)) = 0: c(195) = 0
1950 b(c(15)) = 0: c(15) = 0
150 Next j15
b(c(202)) = 0: c(202) = 0
2020 b(c(22)) = 0: c(22) = 0
220 Next j22
b(c(209)) = 0: c(209) = 0
2090 b(c(29)) = 0: c(29) = 0
290 Next j29
b(c(192)) = 0: c(192) = 0
1920 b(c(7)) = 0: c(7) = 0
70 b(c(187)) = 0: c(187) = 0
1870 b(c(12)) = 0: c(12) = 0
120 b(c(198)) = 0: c(198) = 0
1980 b(c(13)) = 0: c(13) = 0
130 b(c(193)) = 0: c(193) = 0
1930 b(c(18)) = 0: c(18) = 0
180 Next j18
b(c(204)) = 0: c(204) = 0
2040 b(c(19)) = 0: c(19) = 0
190 b(c(199)) = 0: c(199) = 0
1990 b(c(24)) = 0: c(24) = 0
240 Next j24
b(c(210)) = 0: c(210) = 0
2100 b(c(25)) = 0: c(25) = 0
250 b(c(205)) = 0: c(205) = 0
2050 b(c(30)) = 0: c(30) = 0
300 Next j30
b(c(212)) = 0: c(212) = 0
2120 b(c(2)) = 0: c(2) = 0
20 b(c(182)) = 0: c(182) = 0
1820 b(c(32)) = 0: c(32) = 0
320 b(c(213)) = 0: c(213) = 0
2130 b(c(3)) = 0: c(3) = 0
30 b(c(183)) = 0: c(183) = 0
1830 b(c(33)) = 0: c(33) = 0
330 Next j33
b(c(214)) = 0: c(214) = 0
2140 b(c(4)) = 0: c(4) = 0
40 b(c(184)) = 0: c(184) = 0
1840 b(c(34)) = 0: c(34) = 0
340 Next j34
b(c(215)) = 0: c(215) = 0
2150 b(c(5)) = 0: c(5) = 0
50 b(c(185)) = 0: c(185) = 0
1850 b(c(35)) = 0: c(35) = 0
350 Next j35
b(c(211)) = 0: c(211) = 0
2110 b(c(6)) = 0: c(6) = 0
60 b(c(216)) = 0: c(216) = 0
2160 b(c(1)) = 0: c(1) = 0
10 Next j1
b(c(186)) = 0: c(186) = 0
1860 b(c(31)) = 0: c(31) = 0
310 Next j31
b(c(181)) = 0: c(181) = 0
1810 b(c(36)) = 0: c(36) = 0
360 Next j36
1000 Erase b1, b, c: n6 = 0
Next j100
t2 = Timer
t10 = Str(t2 - t1) + " sec., " + Str(n9) + " Solutions for sum" + Str(s6)
y = MsgBox(t10, 0, "Routine PrimeCubes78a")
End
' Fill Center Cube c6()
750
C6(44) = a(1): C6(45) = a(2): C6(46) = a(3): C6(47) = a(4):
C6(50) = a(5): C6(51) = a(6): C6(52) = a(7): C6(53) = a(8):
C6(56) = a(9): C6(57) = a(10): C6(58) = a(11): C6(59) = a(12):
C6(62) = a(13): C6(63) = a(14): C6(64) = a(15): C6(65) = a(16):
C6(80) = a(17): C6(81) = a(18): C6(82) = a(19): C6(83) = a(20):
C6(86) = a(21): C6(87) = a(22): C6(88) = a(23): C6(89) = a(24):
C6(92) = a(25): C6(93) = a(26): C6(94) = a(27): C6(95) = a(28):
C6(98) = a(29): C6(99) = a(30): C6(100) = a(31): C6(101) = a(32):
C6(116) = a(33): C6(117) = a(34): C6(118) = a(35): C6(119) = a(36):
C6(122) = a(37): C6(123) = a(38): C6(124) = a(39): C6(125) = a(40):
C6(128) = a(41): C6(129) = a(42): C6(130) = a(43): C6(131) = a(44):
C6(134) = a(45): C6(135) = a(46): C6(136) = a(47): C6(137) = a(48):
C6(152) = a(49): C6(153) = a(50): C6(154) = a(51): C6(155) = a(52):
C6(158) = a(53): C6(159) = a(54): C6(160) = a(55): C6(161) = a(56):
C6(164) = a(57): C6(165) = a(58): C6(166) = a(59): C6(167) = a(60):
C6(170) = a(61): C6(171) = a(62): C6(172) = a(63): C6(173) = a(64):
' Determine Diagonals Vertical Planes
' L/R
d(1) = a(1) + a(21) + a(41) + a(61):
d(2) = a(2) + a(22) + a(42) + a(62):
d(3) = a(3) + a(23) + a(43) + a(63):
d(4) = a(4) + a(24) + a(44) + a(64):
d(5) = a(13) + a(25) + a(37) + a(49):
d(6) = a(14) + a(26) + a(38) + a(50):
d(7) = a(15) + a(27) + a(39) + a(51):
d(8) = a(16) + a(28) + a(40) + a(52):
' B/F
d(9) = a(1) + a(18) + a(35) + a(52):
d(10) = a(5) + a(22) + a(39) + a(56):
d(11) = a(9) + a(26) + a(43) + a(60):
d(12) = a(13) + a(30) + a(47) + a(64):
d(13) = a(4) + a(19) + a(34) + a(49):
d(14) = a(8) + a(23) + a(38) + a(53):
d(15) = a(12) + a(27) + a(42) + a(57):
d(16) = a(16) + a(31) + a(46) + a(61):
Return
' Exclude solutions with identical numbers c6()
850 fl1 = 1
For j1 = 1 To 216
a20 = C6(j1): If a20 = 0 Then GoTo 855
For j2 = (1 + j1) To 216
If a20 = C6(j2) Then fl1 = 0: Return
Next j2
855 Next j1
Return
' Print Top and Bottom Square (Line Format)
2650
For i1 = 1 To 36
Cells(n9, i1).Value = C6(i1) 'Top Square
Next i1
For i1 = 37 To 72
Cells(n9, i1).Value = C6(i1 - 36 + 180) 'Bottom Square
Next i1
Cells(1, 76).Value = n9
Cells(n9, 73).Value = s6
Cells(n9, 74).Value = Rcrd1a
Return
' Print Cubes (6 plane format)
2750 n2 = n2 + 1
If n2 = 7 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 = s6 ''n9
Cells(k1, k2 + 2).Value = j100
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 = C6(i3) 'Bordered Magic Cube
Next i2
Next i1
Next i0
Return
' Read Prime Numbers From Sheet ShtNm2
4100 Pr3 = Sheets(ShtNm2).Cells(Rcrd1a, 1).Value 'Pair Sum
s6 = 3 * Pr3: s4 = 2 * Pr3 'MC6
nVar = Sheets(ShtNm2).Cells(Rcrd1a, 5).Value
m1 = 1: m2 = nVar
For i1 = m1 To m2
a1(i1) = Sheets(ShtNm2).Cells(Rcrd1a, i1 + 10).Value
Next i1
pMax = a1(m2)
Erase b1
For i1 = m1 To m2
b1(a1(i1)) = a1(i1)
Next i1
Return
End Sub