' Generates Associated Latin Cubes of order 4 for integers 0 thru 7
' 3D Compact
' Tested with Office 365 under Windows 10
Sub LtnCbs44()
Dim a(64), b(8), s(8)
y = MsgBox("Locked", vbCritical, "Routine LtnCbs44")
End
n2 = 0: n9 = 0: k1 = 1: k2 = 1
m1 = 0: m2 = 7: s1 = 14
' Generate data
Sheets("Klad1").Select
t1 = Timer
For j64 = m1 To m2 'a(64)
a(64) = j64
For j63 = m1 To m2 'a(63)
a(63) = j63
For j62 = m1 To m2 'a(62)
a(62) = j62
a(61) = s1 - a(62) - a(63) - a(64): If a(61) < m1 Or a(61) > m2 Then GoTo 620
For j60 = m1 To m2 'a(60)
a(60) = j60
a(57) = -a(60) + a(62) + a(63): If a(57) < m1 Or a(57) > m2 Then GoTo 600
For j59 = m1 To m2 'a(59)
a(59) = j59
a(58) = s1 - a(59) - a(62) - a(63): If a(58) < m1 Or a(58) > m2 Then GoTo 590
For j56 = m1 To m2 'a(56)
a(56) = j56
a(55) = s1 - a(56) - a(59) - a(60): If a(55) < m1 Or a(55) > m2 Then GoTo 560
a(52) = s1 - a(56) - a(60) - a(64): If a(52) < m1 Or a(52) > m2 Then GoTo 560
a(51) = a(56) + a(60) - a(63): If a(51) < m1 Or a(51) > m2 Then GoTo 560
For j54 = m1 To m2 'a(54)
a(54) = j54
a(53) = -a(54) + a(59) + a(60): If a(53) < m1 Or a(53) > m2 Then GoTo 540
a(50) = -a(54) + a(59) + a(63): If a(50) < m1 Or a(50) > m2 Then GoTo 540
a(49) = a(54) - a(59) + a(64): If a(49) < m1 Or a(49) > m2 Then GoTo 540
' Check Latin Top Square
b(1) = a(49): b(2) = a(50): b(3) = a(51): b(4) = a(52): GoSub 860: If fl1 = 0 Then GoTo 540
b(1) = a(53): b(2) = a(54): b(3) = a(55): b(4) = a(56): GoSub 860: If fl1 = 0 Then GoTo 540
b(1) = a(57): b(2) = a(58): b(3) = a(59): b(4) = a(60): GoSub 860: If fl1 = 0 Then GoTo 540
b(1) = a(61): b(2) = a(62): b(3) = a(63): b(4) = a(64): GoSub 860: If fl1 = 0 Then GoTo 540
b(1) = a(49): b(2) = a(53): b(3) = a(57): b(4) = a(61): GoSub 860: If fl1 = 0 Then GoTo 540
b(1) = a(50): b(2) = a(54): b(3) = a(58): b(4) = a(62): GoSub 860: If fl1 = 0 Then GoTo 540
b(1) = a(51): b(2) = a(55): b(3) = a(59): b(4) = a(63): GoSub 860: If fl1 = 0 Then GoTo 540
b(1) = a(52): b(2) = a(56): b(3) = a(60): b(4) = a(64): GoSub 860: If fl1 = 0 Then GoTo 540
For j48 = m1 To m2 'a(48)
a(48) = j48
a(45) = -a(48) + a(62) + a(63): If a(45) < m1 Or a(45) > m2 Then GoTo 480
a(36) = -a(48) + a(56) + a(60): If a(36) < m1 Or a(36) > m2 Then GoTo 480
a(33) = a(48) - a(54) + a(59): If a(33) < m1 Or a(33) > m2 Then GoTo 480
For j47 = m1 To m2 'a(47)
a(47) = j47
a(46) = s1 - a(47) - a(62) - a(63): If a(46) < m1 Or a(46) > m2 Then GoTo 470
a(35) = s1 - a(47) - a(56) - a(60): If a(35) < m1 Or a(35) > m2 Then GoTo 470
a(34) = a(47) + a(54) - a(59): If a(34) < m1 Or a(34) > m2 Then GoTo 470
For j44 = m1 To m2 'a(44)
a(44) = j44
a(43) = 2 * s1 - a(44) - a(47) - a(48) - a(59) - a(60) - a(63) - a(64):
If a(43) < m1 Or a(43) > m2 Then GoTo 440
a(42) = -a(43) + a(62) + a(63): If a(42) < m1 Or a(42) > m2 Then GoTo 440
a(41) = s1 - a(44) - a(62) - a(63): If a(41) < m1 Or a(41) > m2 Then GoTo 440
a(40) = s1 - a(44) - a(56) - a(60): If a(40) < m1 Or a(40) > m2 Then GoTo 440
a(39) = -a(43) + a(56) + a(60): If a(39) < m1 Or a(39) > m2 Then GoTo 440
a(38) = -a(39) - a(54) + a(56) + a(59) + a(60):
If a(38) < m1 Or a(38) > m2 Then GoTo 440
a(37) = a(44) + a(54) - a(59): If a(37) < m1 Or a(37) > m2 Then GoTo 440
a(32) = s1 / 2 - a(33): a(24) = s1 / 2 - a(41): a(16) = s1 / 2 - a(49): a(8) = s1 / 2 - a(57)
a(31) = s1 / 2 - a(34): a(23) = s1 / 2 - a(42): a(15) = s1 / 2 - a(50): a(7) = s1 / 2 - a(58)
a(30) = s1 / 2 - a(35): a(22) = s1 / 2 - a(43): a(14) = s1 / 2 - a(51): a(6) = s1 / 2 - a(59)
a(29) = s1 / 2 - a(36): a(21) = s1 / 2 - a(44): a(13) = s1 / 2 - a(52): a(5) = s1 / 2 - a(60)
a(28) = s1 / 2 - a(37): a(20) = s1 / 2 - a(45): a(12) = s1 / 2 - a(53): a(4) = s1 / 2 - a(61)
a(27) = s1 / 2 - a(38): a(19) = s1 / 2 - a(46): a(11) = s1 / 2 - a(54): a(3) = s1 / 2 - a(62)
a(26) = s1 / 2 - a(39): a(18) = s1 / 2 - a(47): a(10) = s1 / 2 - a(55): a(2) = s1 / 2 - a(63)
a(25) = s1 / 2 - a(40): a(17) = s1 / 2 - a(48): a(9) = s1 / 2 - a(56): a(1) = s1 / 2 - a(64)
' Exclude solutions with identical numbers in rows, colums or pillars
GoSub 800: If fl1 = 0 Then GoTo 440 'rows, colums or pillars
GoSub 1000: If fl1 = 0 Then GoTo 440 'Compact for Prime Numbers
GoSub 900: If fl1 = 0 Then GoTo 440 'Valid (Semi) Latin Cube
n9 = n9 + 1: GoSub 740 'Print results (selected numbers)
' n9 = n9 + 1: GoSub 750 'Print results (planes 1, 2, 3, 4)
' n9 = n9 + 1: Cells(1, 1).Value = n9 'Counting
440 Next j44
470 Next j47
480 Next j48
540 Next j54
560 Next j56
590 Next j59
600 Next j60
620 Next j62
630 Next j63
640 Next j64
t2 = Timer
t10 = Str(t2 - t1) + " sec., " + Str(n9) + " Solutions for sum" + Str(s1)
y = MsgBox(t10, 0, "Routine LtnCbs4444")
End
' Print results (selected numbers)
740 For i1 = 1 To 64
Cells(n9, i1).Value = a(i1)
Next i1
Cells(1, 67).Value = n9
Return
' Print results (planes 11, 12, 13 and 14)
750 n2 = n2 + 1
If n2 = 9 Then
n2 = 1: k1 = k1 + 20: k2 = 1
Else
If n9 > 1 Then k2 = k2 + 5
End If
Cells(k1, k2 + 1).Select
Cells(k1, k2 + 1).Font.Color = -4165632
Cells(k1, k2 + 1).Value = CStr(n9)
For i0 = 1 To 4
i3 = (4 - i0) * 16
For i1 = 1 To 4
For i2 = 1 To 4
i3 = i3 + 1
Cells(k1 + i1 + (i0 - 1) * 5, k2 + i2).Value = a(i3)
Next i2
Next i1
Next i0
Return
' Exclude solutions with identical numbers in rows, colums or pillars
800 fl1 = 1
' Rows
i1 = -3
For i0 = 1 To 16
i1 = i1 + 4
b(1) = a(i1): b(2) = a(i1 + 1): b(3) = a(i1 + 2): b(4) = a(i1 + 3)
GoSub 860
If fl1 = 0 Then Return
Next i0
' Columns
i1 = 0: i2 = 0
For i0 = 1 To 16
i1 = i1 + 1
b(1) = a(i1): b(2) = a(i1 + 4): b(3) = a(i1 + 8): b(4) = a(i1 + 12)
i2 = i2 + 1: If i2 = 4 Then i2 = 0: i1 = i1 + 12
GoSub 860
If fl1 = 0 Then Return
Next i0
' Pillars
i1 = 0: i2 = 0
For i0 = 1 To 16
i1 = i0
b(1) = a(i1): b(2) = a(i1 + 16): b(3) = a(i1 + 32): b(4) = a(i1 + 48)
GoSub 860
If fl1 = 0 Then Return
Next i0
' Space Diagonals (Non Latin)
b(1) = a(1): b(2) = a(22): b(3) = a(43): b(4) = a(64): GoSub 875: If fl1 = 0 Then Return
b(1) = a(4): b(2) = a(23): b(3) = a(42): b(4) = a(61): GoSub 875: If fl1 = 0 Then Return
b(1) = a(13): b(2) = a(26): b(3) = a(39): b(4) = a(52): GoSub 875: If fl1 = 0 Then Return
b(1) = a(16): b(2) = a(27): b(3) = a(38): b(4) = a(49): GoSub 875: If fl1 = 0 Then Return
Return
860 fl1 = 1
For j1 = 1 To 4
b2 = b(j1)
For j2 = (1 + j1) To 4
If b2 = b(j2) Then fl1 = 0: Return
Next j2
Next j1
GoSub 875 'Check suitable for Prime Numbers
Return
' Check suitable for Prime Numbers
875 fl1 = 1
Erase s
For j1 = 1 To 4
s(b(j1) + 1) = s(b(j1) + 1) + 1
Next j1
For j1 = 1 To 4
If s(j1) <> s(9 - j1) Then fl1 = 0: Return
Next j1
Return
' Valid (Semi) Latin Cube
900 fl1 = 1
Erase s
For i1 = 1 To 64
s(a(i1) + 1) = s(a(i1) + 1) + 1
Next i1
For i1 = 1 To 8
If s(i1) <> 8 Then fl1 = 0: Return
Next i1
Return
' Check 3D Compact
1000 fl1 = 1
' Column 1,2
b(1) = a(49): b(2) = a(50): b(3) = a(53): b(4) = a(54):
b(5) = a(33): b(6) = a(34): b(7) = a(37): b(8) = a(38): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(53): b(2) = a(54): b(3) = a(57): b(4) = a(58):
b(5) = a(37): b(6) = a(38): b(7) = a(41): b(8) = a(42): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(57): b(2) = a(58): b(3) = a(61): b(4) = a(62):
b(5) = a(41): b(6) = a(42): b(7) = a(45): b(8) = a(46): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(61): b(2) = a(62): b(3) = a(49): b(4) = a(50):
b(5) = a(45): b(6) = a(46): b(7) = a(33): b(8) = a(34): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(33): b(2) = a(34): b(3) = a(37): b(4) = a(38):
b(5) = a(17): b(6) = a(18): b(7) = a(21): b(8) = a(22): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(37): b(2) = a(38): b(3) = a(41): b(4) = a(42):
b(5) = a(21): b(6) = a(22): b(7) = a(25): b(8) = a(26): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(41): b(2) = a(42): b(3) = a(45): b(4) = a(46):
b(5) = a(25): b(6) = a(26): b(7) = a(29): b(8) = a(30): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(45): b(2) = a(46): b(3) = a(33): b(4) = a(34):
b(5) = a(29): b(6) = a(30): b(7) = a(17): b(8) = a(18): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(17): b(2) = a(18): b(3) = a(21): b(4) = a(22):
b(5) = a(1): b(6) = a(2): b(7) = a(5): b(8) = a(6): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(21): b(2) = a(22): b(3) = a(25): b(4) = a(26):
b(5) = a(5): b(6) = a(6): b(7) = a(9): b(8) = a(10): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(25): b(2) = a(26): b(3) = a(29): b(4) = a(30):
b(5) = a(9): b(6) = a(10): b(7) = a(13): b(8) = a(14): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(29): b(2) = a(30): b(3) = a(17): b(4) = a(18):
b(5) = a(13): b(6) = a(14): b(7) = a(1): b(8) = a(2): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(1): b(2) = a(2): b(3) = a(5): b(4) = a(6):
b(5) = a(49): b(6) = a(50): b(7) = a(53): b(8) = a(54): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(5): b(2) = a(6): b(3) = a(9): b(4) = a(10):
b(5) = a(53): b(6) = a(54): b(7) = a(57): b(8) = a(58): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(9): b(2) = a(10): b(3) = a(13): b(4) = a(14):
b(5) = a(57): b(6) = a(58): b(7) = a(61): b(8) = a(62): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(13): b(2) = a(14): b(3) = a(1): b(4) = a(2):
b(5) = a(61): b(6) = a(62): b(7) = a(49): b(8) = a(50): GoSub 1060: If fl1 = 0 Then Return
' Column 2,3
b(1) = a(50): b(2) = a(51): b(3) = a(54): b(4) = a(55):
b(5) = a(34): b(6) = a(35): b(7) = a(38): b(8) = a(39): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(54): b(2) = a(55): b(3) = a(58): b(4) = a(59):
b(5) = a(38): b(6) = a(39): b(7) = a(42): b(8) = a(43): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(58): b(2) = a(59): b(3) = a(62): b(4) = a(63):
b(5) = a(42): b(6) = a(43): b(7) = a(46): b(8) = a(47): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(62): b(2) = a(63): b(3) = a(50): b(4) = a(51):
b(5) = a(46): b(6) = a(47): b(7) = a(34): b(8) = a(35): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(34): b(2) = a(35): b(3) = a(38): b(4) = a(39):
b(5) = a(18): b(6) = a(19): b(7) = a(22): b(8) = a(23): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(38): b(2) = a(39): b(3) = a(42): b(4) = a(43):
b(5) = a(22): b(6) = a(23): b(7) = a(26): b(8) = a(27): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(42): b(2) = a(43): b(3) = a(46): b(4) = a(47):
b(5) = a(26): b(6) = a(27): b(7) = a(30): b(8) = a(31): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(46): b(2) = a(47): b(3) = a(34): b(4) = a(35):
b(5) = a(30): b(6) = a(31): b(7) = a(18): b(8) = a(19): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(18): b(2) = a(19): b(3) = a(22): b(4) = a(23):
b(5) = a(2): b(6) = a(3): b(7) = a(6): b(8) = a(7): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(22): b(2) = a(23): b(3) = a(26): b(4) = a(27):
b(5) = a(6): b(6) = a(7): b(7) = a(10): b(8) = a(11): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(26): b(2) = a(27): b(3) = a(30): b(4) = a(31):
b(5) = a(10): b(6) = a(11): b(7) = a(14): b(8) = a(15): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(30): b(2) = a(31): b(3) = a(18): b(4) = a(19):
b(5) = a(14): b(6) = a(15): b(7) = a(2): b(8) = a(3): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(2): b(2) = a(3): b(3) = a(6): b(4) = a(7):
b(5) = a(50): b(6) = a(51): b(7) = a(54): b(8) = a(55): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(6): b(2) = a(7): b(3) = a(10): b(4) = a(11):
b(5) = a(54): b(6) = a(55): b(7) = a(58): b(8) = a(59): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(10): b(2) = a(11): b(3) = a(14): b(4) = a(15):
b(5) = a(58): b(6) = a(59): b(7) = a(62): b(8) = a(63): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(14): b(2) = a(15): b(3) = a(2): b(4) = a(3):
b(5) = a(62): b(6) = a(63): b(7) = a(50): b(8) = a(51): GoSub 1060: If fl1 = 0 Then Return
' Column 3,4
b(1) = a(51): b(2) = a(52): b(3) = a(55): b(4) = a(56):
b(5) = a(35): b(6) = a(36): b(7) = a(39): b(8) = a(40): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(55): b(2) = a(56): b(3) = a(59): b(4) = a(60):
b(5) = a(39): b(6) = a(40): b(7) = a(43): b(8) = a(44): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(59): b(2) = a(60): b(3) = a(63): b(4) = a(64):
b(5) = a(43): b(6) = a(44): b(7) = a(47): b(8) = a(48): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(63): b(2) = a(64): b(3) = a(51): b(4) = a(52):
b(5) = a(47): b(6) = a(48): b(7) = a(35): b(8) = a(36): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(35): b(2) = a(36): b(3) = a(39): b(4) = a(40):
b(5) = a(19): b(6) = a(20): b(7) = a(23): b(8) = a(24): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(39): b(2) = a(40): b(3) = a(43): b(4) = a(44):
b(5) = a(23): b(6) = a(24): b(7) = a(27): b(8) = a(28): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(43): b(2) = a(44): b(3) = a(47): b(4) = a(48):
b(5) = a(27): b(6) = a(28): b(7) = a(31): b(8) = a(32): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(47): b(2) = a(48): b(3) = a(35): b(4) = a(36):
b(5) = a(31): b(6) = a(32): b(7) = a(19): b(8) = a(20): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(19): b(2) = a(20): b(3) = a(23): b(4) = a(24):
b(5) = a(3): b(6) = a(4): b(7) = a(7): b(8) = a(8): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(23): b(2) = a(24): b(3) = a(27): b(4) = a(28):
b(5) = a(7): b(6) = a(8): b(7) = a(11): b(8) = a(12): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(27): b(2) = a(28): b(3) = a(31): b(4) = a(32):
b(5) = a(11): b(6) = a(12): b(7) = a(15): b(8) = a(16): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(31): b(2) = a(32): b(3) = a(19): b(4) = a(20):
b(5) = a(15): b(6) = a(16): b(7) = a(3): b(8) = a(4): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(3): b(2) = a(4): b(3) = a(7): b(4) = a(8):
b(5) = a(51): b(6) = a(52): b(7) = a(55): b(8) = a(56): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(7): b(2) = a(8): b(3) = a(11): b(4) = a(12):
b(5) = a(55): b(6) = a(56): b(7) = a(59): b(8) = a(60): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(11): b(2) = a(12): b(3) = a(15): b(4) = a(16):
b(5) = a(59): b(6) = a(60): b(7) = a(63): b(8) = a(64): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(15): b(2) = a(16): b(3) = a(3): b(4) = a(4):
b(5) = a(63): b(6) = a(64): b(7) = a(51): b(8) = a(52): GoSub 1060: If fl1 = 0 Then Return
' Column 4,1
b(1) = a(52): b(2) = a(49): b(3) = a(56): b(4) = a(53):
b(5) = a(36): b(6) = a(33): b(7) = a(40): b(8) = a(37): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(56): b(2) = a(53): b(3) = a(60): b(4) = a(57):
b(5) = a(40): b(6) = a(37): b(7) = a(44): b(8) = a(41): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(60): b(2) = a(57): b(3) = a(64): b(4) = a(61):
b(5) = a(44): b(6) = a(41): b(7) = a(48): b(8) = a(45): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(64): b(2) = a(61): b(3) = a(52): b(4) = a(49):
b(5) = a(48): b(6) = a(45): b(7) = a(36): b(8) = a(33): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(36): b(2) = a(33): b(3) = a(40): b(4) = a(37):
b(5) = a(20): b(6) = a(17): b(7) = a(24): b(8) = a(21): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(40): b(2) = a(37): b(3) = a(44): b(4) = a(41):
b(5) = a(24): b(6) = a(21): b(7) = a(28): b(8) = a(25): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(44): b(2) = a(41): b(3) = a(48): b(4) = a(45):
b(5) = a(28): b(6) = a(25): b(7) = a(32): b(8) = a(29): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(48): b(2) = a(45): b(3) = a(36): b(4) = a(33):
b(5) = a(32): b(6) = a(29): b(7) = a(20): b(8) = a(17): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(20): b(2) = a(17): b(3) = a(24): b(4) = a(21):
b(5) = a(4): b(6) = a(1): b(7) = a(8): b(8) = a(5): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(24): b(2) = a(21): b(3) = a(28): b(4) = a(25):
b(5) = a(8): b(6) = a(5): b(7) = a(12): b(8) = a(9): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(28): b(2) = a(25): b(3) = a(32): b(4) = a(29):
b(5) = a(12): b(6) = a(9): b(7) = a(16): b(8) = a(13): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(32): b(2) = a(29): b(3) = a(20): b(4) = a(17):
b(5) = a(16): b(6) = a(13): b(7) = a(4): b(8) = a(1): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(4): b(2) = a(1): b(3) = a(8): b(4) = a(5):
b(5) = a(52): b(6) = a(49): b(7) = a(56): b(8) = a(53): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(8): b(2) = a(5): b(3) = a(12): b(4) = a(9):
b(5) = a(56): b(6) = a(53): b(7) = a(60): b(8) = a(57): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(12): b(2) = a(9): b(3) = a(16): b(4) = a(13):
b(5) = a(60): b(6) = a(57): b(7) = a(64): b(8) = a(61): GoSub 1060: If fl1 = 0 Then Return
b(1) = a(16): b(2) = a(13): b(3) = a(4): b(4) = a(1):
b(5) = a(64): b(6) = a(61): b(7) = a(52): b(8) = a(49): GoSub 1060: If fl1 = 0 Then Return
Return
' Check suitable for Prime Numbers
1060 fl1 = 1
Erase s
For j1 = 1 To 8
s(b(j1) + 1) = s(b(j1) + 1) + 1
Next j1
For j1 = 1 To 8
If s(j1) <> s(9 - j1) Then fl1 = 0: Return
Next j1
Return
End Sub