Vorige Pagina About the Author

' Generates Quadrant P34 Pan Magic Squares of order 13, MC = 1105
' Based on Latin Top Rows (Example 1)

' Tested with Office 365 under Windows 10

Sub CnstrP34a()

Dim a(169), b(169), c(169), a1(13), b1(13), s(152), nP(38)

k1 = 1: k2 = 1: s1 = 1105

y = MsgBox("Blocke", vbCritical, "CnstrP34")
End

t1 = Timer

For j100 = 1 To 72      'Based on Example # 1

    For i1 = 1 To 13
        a1(i1) = Sheets("LnsP34").Cells(j100, i1)
    Next i1
    
    GoSub 100           'Construct Square a()
    GoSub 200           'Construct Square b()

'   Construct Square c()

    For i1 = 1 To 169
        c(i1) = a(i1) + 13 * b(i1) + 1
    Next i1

'   Check Identical Integers

    GoSub 300: If fl1 = 0 Then GoTo 1000

    GoSub 700

    n9 = n9 + 1: GoSub 2650             'Print Squares
''  n9 = n9 + 1: Cells(1, 1).Value = n9 'Counting

1000 Next j100

t2 = Timer

    t10 = Str(t2 - t1) + " sec., " + Str(n9) + " Solutions for sum" + Str(s1)
    y = MsgBox(t10, 0, "Routine CnstrP34a")

End

'   Construct Square a()

100
    For i1 = 1 To 13: a(i1) = a1(i1): Next i1

    a(14) = a(3):   a(15) = a(4):   a(16) = a(5):   a(17) = a(6):   a(18) = a(7):   a(19) = a(8):   a(20) = a(9):
    a(21) = a(10):  a(22) = a(11):  a(23) = a(12):  a(24) = a(13):  a(25) = a(1):   a(26) = a(2):
    a(27) = a(5):   a(28) = a(6):   a(29) = a(7):   a(30) = a(8):   a(31) = a(9):   a(32) = a(10):  a(33) = a(11):
    a(34) = a(12):  a(35) = a(13):  a(36) = a(1):   a(37) = a(2):   a(38) = a(3):   a(39) = a(4):
    a(40) = a(7):   a(41) = a(8):   a(42) = a(9):   a(43) = a(10):  a(44) = a(11):  a(45) = a(12):  a(46) = a(13):
    a(47) = a(1):   a(48) = a(2):   a(49) = a(3):   a(50) = a(4):   a(51) = a(5):   a(52) = a(6):
    a(53) = a(9):   a(54) = a(10):  a(55) = a(11):  a(56) = a(12):  a(57) = a(13):  a(58) = a(1):   a(59) = a(2):
    a(60) = a(3):   a(61) = a(4):   a(62) = a(5):   a(63) = a(6):   a(64) = a(7):   a(65) = a(8):
    a(66) = a(11):  a(67) = a(12):  a(68) = a(13):  a(69) = a(1):   a(70) = a(2):   a(71) = a(3):   a(72) = a(4):
    a(73) = a(5):   a(74) = a(6):   a(75) = a(7):   a(76) = a(8):   a(77) = a(9):   a(78) = a(10):
    a(79) = a(13):  a(80) = a(1):   a(81) = a(2):   a(82) = a(3):   a(83) = a(4):   a(84) = a(5):   a(85) = a(6):
    a(86) = a(7):   a(87) = a(8):   a(88) = a(9):   a(89) = a(10):  a(90) = a(11):  a(91) = a(12):
    a(92) = a(2):   a(93) = a(3):   a(94) = a(4):   a(95) = a(5):   a(96) = a(6):   a(97) = a(7):   a(98) = a(8):
    a(99) = a(9):   a(100) = a(10): a(101) = a(11): a(102) = a(12): a(103) = a(13): a(104) = a(1):
    a(105) = a(4):  a(106) = a(5):  a(107) = a(6):  a(108) = a(7):  a(109) = a(8):  a(110) = a(9):  a(111) = a(10):
    a(112) = a(11): a(113) = a(12): a(114) = a(13): a(115) = a(1):  a(116) = a(2):  a(117) = a(3):
    a(118) = a(6):  a(119) = a(7):  a(120) = a(8):  a(121) = a(9):  a(122) = a(10): a(123) = a(11): a(124) = a(12):
    a(125) = a(13): a(126) = a(1):  a(127) = a(2):  a(128) = a(3):  a(129) = a(4):  a(130) = a(5):
    a(131) = a(8):  a(132) = a(9):  a(133) = a(10): a(134) = a(11): a(135) = a(12): a(136) = a(13): a(137) = a(1):
    a(138) = a(2):  a(139) = a(3):  a(140) = a(4):  a(141) = a(5):  a(142) = a(6):  a(143) = a(7):
    a(144) = a(10): a(145) = a(11): a(146) = a(12): a(147) = a(13): a(148) = a(1):  a(149) = a(2):  a(150) = a(3):
    a(151) = a(4):  a(152) = a(5):  a(153) = a(6):  a(154) = a(7):  a(155) = a(8):  a(156) = a(9):
    a(157) = a(12): a(158) = a(13): a(159) = a(1):  a(160) = a(2):  a(161) = a(3):  a(162) = a(4):  a(163) = a(5):
    a(164) = a(6):  a(165) = a(7):  a(166) = a(8):  a(167) = a(9):  a(168) = a(10): a(169) = a(11):

    Return

'   Construct Square b()
    
200

    b(1) = a(6):    b(2) = a(7):    b(3) = a(8):    b(4) = a(9):    b(5) = a(10):   b(6) = a(11):   b(7) = a(12):
    b(8) = a(13):   b(9) = a(1):    b(10) = a(2):   b(11) = a(3):   b(12) = a(4):   b(13) = a(5):
    b(14) = a(13):  b(15) = a(1):   b(16) = a(2):   b(17) = a(3):   b(18) = a(4):   b(19) = a(5):   b(20) = a(6):
    b(21) = a(7):   b(22) = a(8):   b(23) = a(9):   b(24) = a(10):  b(25) = a(11):  b(26) = a(12):
    b(27) = a(7):   b(28) = a(8):   b(29) = a(9):   b(30) = a(10):  b(31) = a(11):  b(32) = a(12):  b(33) = a(13):
    b(34) = a(1):   b(35) = a(2):   b(36) = a(3):   b(37) = a(4):   b(38) = a(5):   b(39) = a(6):
    b(40) = a(1):   b(41) = a(2):   b(42) = a(3):   b(43) = a(4):   b(44) = a(5):   b(45) = a(6):   b(46) = a(7):
    b(47) = a(8):   b(48) = a(9):   b(49) = a(10):  b(50) = a(11):  b(51) = a(12):  b(52) = a(13):
    b(53) = a(8):   b(54) = a(9):   b(55) = a(10):  b(56) = a(11):  b(57) = a(12):  b(58) = a(13):  b(59) = a(1):
    b(60) = a(2):   b(61) = a(3):   b(62) = a(4):   b(63) = a(5):   b(64) = a(6):   b(65) = a(7):
    b(66) = a(2):   b(67) = a(3):   b(68) = a(4):   b(69) = a(5):   b(70) = a(6):   b(71) = a(7):   b(72) = a(8):
    b(73) = a(9):   b(74) = a(10):  b(75) = a(11):  b(76) = a(12):  b(77) = a(13):  b(78) = a(1):
    b(79) = a(9):   b(80) = a(10):  b(81) = a(11):  b(82) = a(12):  b(83) = a(13):  b(84) = a(1):   b(85) = a(2):
    b(86) = a(3):   b(87) = a(4):   b(88) = a(5):   b(89) = a(6):   b(90) = a(7):   b(91) = a(8):
    b(92) = a(3):   b(93) = a(4):   b(94) = a(5):   b(95) = a(6):   b(96) = a(7):   b(97) = a(8):   b(98) = a(9):
    b(99) = a(10):  b(100) = a(11): b(101) = a(12): b(102) = a(13): b(103) = a(1):  b(104) = a(2):
    b(105) = a(10): b(106) = a(11): b(107) = a(12): b(108) = a(13): b(109) = a(1):  b(110) = a(2):  b(111) = a(3):
    b(112) = a(4):  b(113) = a(5):  b(114) = a(6):  b(115) = a(7):  b(116) = a(8):  b(117) = a(9):
    b(118) = a(4):  b(119) = a(5):  b(120) = a(6):  b(121) = a(7):  b(122) = a(8):  b(123) = a(9):  b(124) = a(10):
    b(125) = a(11): b(126) = a(12): b(127) = a(13): b(128) = a(1):  b(129) = a(2):  b(130) = a(3):
    b(131) = a(11): b(132) = a(12): b(133) = a(13): b(134) = a(1):  b(135) = a(2):  b(136) = a(3):  b(137) = a(4):
    b(138) = a(5):  b(139) = a(6):  b(140) = a(7):  b(141) = a(8):  b(142) = a(9):  b(143) = a(10):
    b(144) = a(5):  b(145) = a(6):  b(146) = a(7):  b(147) = a(8):  b(148) = a(9):  b(149) = a(10): b(150) = a(11):
    b(151) = a(12): b(152) = a(13): b(153) = a(1):  b(154) = a(2):  b(155) = a(3):  b(156) = a(4):
    b(157) = a(12): b(158) = a(13): b(159) = a(1):  b(160) = a(2):  b(161) = a(3):  b(162) = a(4):  b(163) = a(5):
    b(164) = a(6):  b(165) = a(7):  b(166) = a(8):  b(167) = a(9):  b(168) = a(10): b(169) = a(11):

    Return

'   Check identical numbers
    
300 fl1 = 1
    For i1 = 1 To 169
       c2 = c(i1)
       For i2 = (1 + i1) To 169
           If c2 = c(i2) Then fl1 = 0: Return
       Next i2
    Next i1
    Return

'   Check Magic Patterns

700 fl1 = 1: nQ = 0: Erase nP, s

s(1) = c(4) + c(17) + c(30) + c(40) + c(41) + c(42) + c(43) + c(44) + c(45) + c(46) + c(56) + c(69) + c(82)   'P01
s(2) = c(10) + c(23) + c(36) + c(46) + c(47) + c(48) + c(49) + c(50) + c(51) + c(52) + c(62) + c(75) + c(88)
s(3) = c(82) + c(95) + c(108) + c(118) + c(119) + c(120) + c(121) + c(122) + c(123) + c(124) + c(134) + c(147) + c(160)
s(4) = c(88) + c(101) + c(114) + c(124) + c(125) + c(126) + c(127) + c(128) + c(129) + c(130) + c(140) + c(153) + c(166)

s(5) = c(17) + c(29) + c(30) + c(31) + c(41) + c(42) + c(43) + c(44) + c(45) + c(55) + c(56) + c(57) + c(69)  'P02
s(6) = c(23) + c(35) + c(36) + c(37) + c(47) + c(48) + c(49) + c(50) + c(51) + c(61) + c(62) + c(63) + c(75)
s(7) = c(95) + c(107) + c(108) + c(109) + c(119) + c(120) + c(121) + c(122) + c(123) + c(133) + c(134) + c(135) + c(147)
s(8) = c(101) + c(113) + c(114) + c(115) + c(125) + c(126) + c(127) + c(128) + c(129) + c(139) + c(140) + c(141) + c(153)

s(9) = c(4) + c(29) + c(30) + c(31) + c(40) + c(42) + c(43) + c(44) + c(46) + c(55) + c(56) + c(57) + c(82)   'P03
s(10) = c(10) + c(35) + c(36) + c(37) + c(46) + c(48) + c(49) + c(50) + c(52) + c(61) + c(62) + c(63) + c(88)
s(11) = c(82) + c(107) + c(108) + c(109) + c(118) + c(120) + c(121) + c(122) + c(124) + c(133) + c(134) + c(135) + c(160)
s(12) = c(88) + c(113) + c(114) + c(115) + c(124) + c(126) + c(127) + c(128) + c(130) + c(139) + c(140) + c(141) + c(166)

s(13) = c(4) + c(17) + c(29) + c(31) + c(40) + c(41) + c(43) + c(45) + c(46) + c(55) + c(57) + c(69) + c(82)  'P04
s(14) = c(10) + c(23) + c(35) + c(37) + c(46) + c(47) + c(49) + c(51) + c(52) + c(61) + c(63) + c(75) + c(88)
s(15) = c(82) + c(95) + c(107) + c(109) + c(118) + c(119) + c(121) + c(123) + c(124) + c(133) + c(135) + c(147) + c(160)
s(16) = c(88) + c(101) + c(113) + c(115) + c(124) + c(125) + c(127) + c(129) + c(130) + c(139) + c(141) + c(153) + c(166)

s(17) = c(15) + c(17) + c(19) + c(30) + c(41) + c(42) + c(43) + c(44) + c(45) + c(56) + c(67) + c(69) + c(71) 'P05
s(18) = c(21) + c(23) + c(25) + c(36) + c(47) + c(48) + c(49) + c(50) + c(51) + c(62) + c(73) + c(75) + c(77)
s(19) = c(93) + c(95) + c(97) + c(108) + c(119) + c(120) + c(121) + c(122) + c(123) + c(134) + c(145) + c(147) + c(149)
s(20) = c(99) + c(101) + c(103) + c(114) + c(125) + c(126) + c(127) + c(128) + c(129) + c(140) + c(151) + c(153) + c(155)

s(21) = c(4) + c(15) + c(19) + c(30) + c(40) + c(42) + c(43) + c(44) + c(46) + c(56) + c(67) + c(71) + c(82)  'P06
s(22) = c(10) + c(21) + c(25) + c(36) + c(46) + c(48) + c(49) + c(50) + c(52) + c(62) + c(73) + c(77) + c(88)
s(23) = c(82) + c(93) + c(97) + c(108) + c(118) + c(120) + c(121) + c(122) + c(124) + c(134) + c(145) + c(149) + c(160)
s(24) = c(88) + c(99) + c(103) + c(114) + c(124) + c(126) + c(127) + c(128) + c(130) + c(140) + c(151) + c(155) + c(166)

s(25) = c(4) + c(15) + c(17) + c(19) + c(40) + c(41) + c(43) + c(45) + c(46) + c(67) + c(69) + c(71) + c(82)  'P07 
s(26) = c(10) + c(21) + c(23) + c(25) + c(46) + c(47) + c(49) + c(51) + c(52) + c(73) + c(75) + c(77) + c(88)
s(27) = c(82) + c(93) + c(95) + c(97) + c(118) + c(119) + c(121) + c(123) + c(124) + c(145) + c(147) + c(149) + c(160)
s(28) = c(88) + c(99) + c(101) + c(103) + c(124) + c(125) + c(127) + c(129) + c(130) + c(151) + c(153) + c(155) + c(166)

s(29) = c(15) + c(19) + c(29) + c(30) + c(31) + c(42) + c(43) + c(44) + c(55) + c(56) + c(57) + c(67) + c(71) 'P08 
s(30) = c(21) + c(25) + c(35) + c(36) + c(37) + c(48) + c(49) + c(50) + c(61) + c(62) + c(63) + c(73) + c(77)
s(31) = c(93) + c(97) + c(107) + c(108) + c(109) + c(120) + c(121) + c(122) + c(133) + c(134) + c(135) + c(145) + c(149)
s(32) = c(99) + c(103) + c(113) + c(114) + c(115) + c(126) + c(127) + c(128) + c(139) + c(140) + c(141) + c(151) + c(155)

s(33) = c(15) + c(17) + c(19) + c(29) + c(31) + c(41) + c(43) + c(45) + c(55) + c(57) + c(67) + c(69) + c(71) 'P09
s(34) = c(21) + c(23) + c(25) + c(35) + c(37) + c(47) + c(49) + c(51) + c(61) + c(63) + c(73) + c(75) + c(77)
s(35) = c(93) + c(95) + c(97) + c(107) + c(109) + c(119) + c(121) + c(123) + c(133) + c(135) + c(145) + c(147) + c(149)
s(36) = c(99) + c(101) + c(103) + c(113) + c(115) + c(125) + c(127) + c(129) + c(139) + c(141) + c(151) + c(153) + c(155)

s(37) = c(4) + c(15) + c(19) + c(29) + c(31) + c(40) + c(43) + c(46) + c(55) + c(57) + c(67) + c(71) + c(82)  'P10
s(38) = c(10) + c(21) + c(25) + c(35) + c(37) + c(46) + c(49) + c(52) + c(61) + c(63) + c(73) + c(77) + c(88)
s(39) = c(82) + c(93) + c(97) + c(107) + c(109) + c(118) + c(121) + c(124) + c(133) + c(135) + c(145) + c(149) + c(160)
s(40) = c(88) + c(99) + c(103) + c(113) + c(115) + c(124) + c(127) + c(130) + c(139) + c(141) + c(151) + c(155) + c(166)

s(41) = c(1) + c(7) + c(17) + c(30) + c(41) + c(42) + c(43) + c(44) + c(45) + c(56) + c(69) + c(79) + c(85)   'P11
s(42) = c(7) + c(13) + c(23) + c(36) + c(47) + c(48) + c(49) + c(50) + c(51) + c(62) + c(75) + c(85) + c(91)
s(43) = c(79) + c(85) + c(95) + c(108) + c(119) + c(120) + c(121) + c(122) + c(123) + c(134) + c(147) + c(157) + c(163)
s(44) = c(85) + c(91) + c(101) + c(114) + c(125) + c(126) + c(127) + c(128) + c(129) + c(140) + c(153) + c(163) + c(169)

s(45) = c(1) + c(4) + c(7) + c(30) + c(40) + c(42) + c(43) + c(44) + c(46) + c(56) + c(79) + c(82) + c(85)    'P12
s(46) = c(7) + c(10) + c(13) + c(36) + c(46) + c(48) + c(49) + c(50) + c(52) + c(62) + c(85) + c(88) + c(91)
s(47) = c(79) + c(82) + c(85) + c(108) + c(118) + c(120) + c(121) + c(122) + c(124) + c(134) + c(157) + c(160) + c(163)
s(48) = c(85) + c(88) + c(91) + c(114) + c(124) + c(126) + c(127) + c(128) + c(130) + c(140) + c(163) + c(166) + c(169)

s(49) = c(1) + c(4) + c(7) + c(17) + c(40) + c(41) + c(43) + c(45) + c(46) + c(69) + c(79) + c(82) + c(85)    'P13
s(50) = c(7) + c(10) + c(13) + c(23) + c(46) + c(47) + c(49) + c(51) + c(52) + c(75) + c(85) + c(88) + c(91)
s(51) = c(79) + c(82) + c(85) + c(95) + c(118) + c(119) + c(121) + c(123) + c(124) + c(147) + c(157) + c(160) + c(163)
s(52) = c(85) + c(88) + c(91) + c(101) + c(124) + c(125) + c(127) + c(129) + c(130) + c(153) + c(163) + c(166) + c(169)

s(53) = c(1) + c(7) + c(29) + c(30) + c(31) + c(42) + c(43) + c(44) + c(55) + c(56) + c(57) + c(79) + c(85)   'P14
s(54) = c(7) + c(13) + c(35) + c(36) + c(37) + c(48) + c(49) + c(50) + c(61) + c(62) + c(63) + c(85) + c(91)
s(55) = c(79) + c(85) + c(107) + c(108) + c(109) + c(120) + c(121) + c(122) + c(133) + c(134) + c(135) + c(157) + c(163)
s(56) = c(85) + c(91) + c(113) + c(114) + c(115) + c(126) + c(127) + c(128) + c(139) + c(140) + c(141) + c(163) + c(169)

s(57) = c(1) + c(7) + c(17) + c(29) + c(31) + c(41) + c(43) + c(45) + c(55) + c(57) + c(69) + c(79) + c(85)   'P15
s(58) = c(7) + c(13) + c(23) + c(35) + c(37) + c(47) + c(49) + c(51) + c(61) + c(63) + c(75) + c(85) + c(91)
s(59) = c(79) + c(85) + c(95) + c(107) + c(109) + c(119) + c(121) + c(123) + c(133) + c(135) + c(147) + c(157) + c(163)
s(60) = c(85) + c(91) + c(101) + c(113) + c(115) + c(125) + c(127) + c(129) + c(139) + c(141) + c(153) + c(163) + c(169)

s(61) = c(1) + c(4) + c(7) + c(29) + c(31) + c(40) + c(43) + c(46) + c(55) + c(57) + c(79) + c(82) + c(85)    'P16
s(62) = c(7) + c(10) + c(13) + c(35) + c(37) + c(46) + c(49) + c(52) + c(61) + c(63) + c(85) + c(88) + c(91)
s(63) = c(79) + c(82) + c(85) + c(107) + c(109) + c(118) + c(121) + c(124) + c(133) + c(135) + c(157) + c(160) + c(163)
s(64) = c(85) + c(88) + c(91) + c(113) + c(115) + c(124) + c(127) + c(130) + c(139) + c(141) + c(163) + c(166) + c(169)

s(65) = c(1) + c(7) + c(15) + c(19) + c(30) + c(42) + c(43) + c(44) + c(56) + c(67) + c(71) + c(79) + c(85)   'P17
s(66) = c(7) + c(13) + c(21) + c(25) + c(36) + c(48) + c(49) + c(50) + c(62) + c(73) + c(77) + c(85) + c(91)
s(67) = c(79) + c(85) + c(93) + c(97) + c(108) + c(120) + c(121) + c(122) + c(134) + c(145) + c(149) + c(157) + c(163)
s(68) = c(85) + c(91) + c(99) + c(103) + c(114) + c(126) + c(127) + c(128) + c(140) + c(151) + c(155) + c(163) + c(169)

s(69) = c(1) + c(7) + c(15) + c(17) + c(19) + c(41) + c(43) + c(45) + c(67) + c(69) + c(71) + c(79) + c(85)   'P18
s(70) = c(7) + c(13) + c(21) + c(23) + c(25) + c(47) + c(49) + c(51) + c(73) + c(75) + c(77) + c(85) + c(91)
s(71) = c(79) + c(85) + c(93) + c(95) + c(97) + c(119) + c(121) + c(123) + c(145) + c(147) + c(149) + c(157) + c(163)
s(72) = c(85) + c(91) + c(99) + c(101) + c(103) + c(125) + c(127) + c(129) + c(151) + c(153) + c(155) + c(163) + c(169)

s(73) = c(1) + c(4) + c(7) + c(15) + c(19) + c(40) + c(43) + c(46) + c(67) + c(71) + c(79) + c(82) + c(85)    'P19
s(74) = c(7) + c(10) + c(13) + c(21) + c(25) + c(46) + c(49) + c(52) + c(73) + c(77) + c(85) + c(88) + c(91)
s(75) = c(79) + c(82) + c(85) + c(93) + c(97) + c(118) + c(121) + c(124) + c(145) + c(149) + c(157) + c(160) + c(163)
s(76) = c(85) + c(88) + c(91) + c(99) + c(103) + c(124) + c(127) + c(130) + c(151) + c(155) + c(163) + c(166) + c(169)

s(77) = c(1) + c(7) + c(15) + c(19) + c(29) + c(31) + c(43) + c(55) + c(57) + c(67) + c(71) + c(79) + c(85)   'P20
s(78) = c(7) + c(13) + c(21) + c(25) + c(35) + c(37) + c(49) + c(61) + c(63) + c(73) + c(77) + c(85) + c(91)
s(79) = c(79) + c(85) + c(93) + c(97) + c(107) + c(109) + c(121) + c(133) + c(135) + c(145) + c(149) + c(157) + c(163)
s(80) = c(85) + c(91) + c(99) + c(103) + c(113) + c(115) + c(127) + c(139) + c(141) + c(151) + c(155) + c(163) + c(169)

s(81) = c(16) + c(18) + c(28) + c(30) + c(32) + c(42) + c(43) + c(44) + c(54) + c(56) + c(58) + c(68) + c(70) 'P21
s(82) = c(22) + c(24) + c(34) + c(36) + c(38) + c(48) + c(49) + c(50) + c(60) + c(62) + c(64) + c(74) + c(76)
s(83) = c(94) + c(96) + c(106) + c(108) + c(110) + c(120) + c(121) + c(122) + c(132) + c(134) + c(136) + c(146) + c(148)
s(84) = c(100) + c(102) + c(112) + c(114) + c(116) + c(126) + c(127) + c(128) + c(138) + c(140) + c(142) + c(152) + c(154)

s(85) = c(16) + c(17) + c(18) + c(28) + c(32) + c(41) + c(43) + c(45) + c(54) + c(58) + c(68) + c(69) + c(70) 'P22
s(86) = c(22) + c(23) + c(24) + c(34) + c(38) + c(47) + c(49) + c(51) + c(60) + c(64) + c(74) + c(75) + c(76)
s(87) = c(94) + c(95) + c(96) + c(106) + c(110) + c(119) + c(121) + c(123) + c(132) + c(136) + c(146) + c(147) + c(148)
s(88) = c(100) + c(101) + c(102) + c(112) + c(116) + c(125) + c(127) + c(129) + c(138) + c(142) + c(152) + c(153) + c(154)

s(89) = c(4) + c(16) + c(18) + c(28) + c(32) + c(40) + c(43) + c(46) + c(54) + c(58) + c(68) + c(70) + c(82)  'P23 (Dia)
s(90) = c(10) + c(22) + c(24) + c(34) + c(38) + c(46) + c(49) + c(52) + c(60) + c(64) + c(74) + c(76) + c(88)
s(91) = c(82) + c(94) + c(96) + c(106) + c(110) + c(118) + c(121) + c(124) + c(132) + c(136) + c(146) + c(148) + c(160)
s(92) = c(88) + c(100) + c(102) + c(112) + c(116) + c(124) + c(127) + c(130) + c(138) + c(142) + c(152) + c(154) + c(166)

s(93) = c(16) + c(18) + c(28) + c(29) + c(31) + c(32) + c(43) + c(54) + c(55) + c(57) + c(58) + c(68) + c(70) 'P24
s(94) = c(22) + c(24) + c(34) + c(35) + c(37) + c(38) + c(49) + c(60) + c(61) + c(63) + c(64) + c(74) + c(76)
s(95) = c(94) + c(96) + c(106) + c(107) + c(109) + c(110) + c(121) + c(132) + c(133) + c(135) + c(136) + c(146) + c(148)
s(96) = c(100) + c(102) + c(112) + c(113) + c(115) + c(116) + c(127) + c(138) + c(139) + c(141) + c(142) + c(152) + c(154)

s(97) = c(15) + c(16) + c(18) + c(19) + c(28) + c(32) + c(43) + c(54) + c(58) + c(67) + c(68) + c(70) + c(71) 'P25
s(98) = c(21) + c(22) + c(24) + c(25) + c(34) + c(38) + c(49) + c(60) + c(64) + c(73) + c(74) + c(76) + c(77)
s(99) = c(93) + c(94) + c(96) + c(97) + c(106) + c(110) + c(121) + c(132) + c(136) + c(145) + c(146) + c(148) + c(149)
s(100) = c(99) + c(100) + c(102) + c(103) + c(112) + c(116) + c(127) + c(138) + c(142) + c(151) + c(152) + c(154) + c(155)

s(101) = c(1) + c(7) + c(16) + c(18) + c(28) + c(32) + c(43) + c(54) + c(58) + c(68) + c(70) + c(79) + c(85) 'P26
s(102) = c(7) + c(13) + c(22) + c(24) + c(34) + c(38) + c(49) + c(60) + c(64) + c(74) + c(76) + c(85) + c(91)
s(103) = c(79) + c(85) + c(94) + c(96) + c(106) + c(110) + c(121) + c(132) + c(136) + c(146) + c(148) + c(157) + c(163)
s(104) = c(85) + c(91) + c(100) + c(102) + c(112) + c(116) + c(127) + c(138) + c(142) + c(152) + c(154) + c(163) + c(169)

s(105) = c(3) + c(5) + c(27) + c(30) + c(33) + c(42) + c(43) + c(44) + c(53) + c(56) + c(59) + c(81) + c(83) 'P27
s(106) = c(9) + c(11) + c(33) + c(36) + c(39) + c(48) + c(49) + c(50) + c(59) + c(62) + c(65) + c(87) + c(89)
s(107) = c(81) + c(83) + c(105) + c(108) + c(111) + c(120) + c(121) + c(122) + c(131) + c(134) + c(137) + c(159) + c(161)
s(108) = c(87) + c(89) + c(111) + c(114) + c(117) + c(126) + c(127) + c(128) + c(137) + c(140) + c(143) + c(165) + c(167)

s(109) = c(3) + c(5) + c(17) + c(27) + c(33) + c(41) + c(43) + c(45) + c(53) + c(59) + c(69) + c(81) + c(83) 'P28
s(110) = c(9) + c(11) + c(23) + c(33) + c(39) + c(47) + c(49) + c(51) + c(59) + c(65) + c(75) + c(87) + c(89)
s(111) = c(81) + c(83) + c(95) + c(105) + c(111) + c(119) + c(121) + c(123) + c(131) + c(137) + c(147) + c(159) + c(161)
s(112) = c(87) + c(89) + c(101) + c(111) + c(117) + c(125) + c(127) + c(129) + c(137) + c(143) + c(153) + c(165) + c(167)

s(113) = c(3) + c(4) + c(5) + c(27) + c(33) + c(40) + c(43) + c(46) + c(53) + c(59) + c(81) + c(82) + c(83)  'P29
s(114) = c(9) + c(10) + c(11) + c(33) + c(39) + c(46) + c(49) + c(52) + c(59) + c(65) + c(87) + c(88) + c(89)
s(115) = c(81) + c(82) + c(83) + c(105) + c(111) + c(118) + c(121) + c(124) + c(131) + c(137) + c(159) + c(160) + c(161)
s(116) = c(87) + c(88) + c(89) + c(111) + c(117) + c(124) + c(127) + c(130) + c(137) + c(143) + c(165) + c(166) + c(167)

s(117) = c(3) + c(5) + c(27) + c(29) + c(31) + c(33) + c(43) + c(53) + c(55) + c(57) + c(59) + c(81) + c(83) 'P30
s(118) = c(9) + c(11) + c(33) + c(35) + c(37) + c(39) + c(49) + c(59) + c(61) + c(63) + c(65) + c(87) + c(89)
s(119) = c(81) + c(83) + c(105) + c(107) + c(109) + c(111) + c(121) + c(131) + c(133) + c(135) + c(137) + c(159) + c(161)
s(120) = c(87) + c(89) + c(111) + c(113) + c(115) + c(117) + c(127) + c(137) + c(139) + c(141) + c(143) + c(165) + c(167)

s(121) = c(3) + c(5) + c(15) + c(19) + c(27) + c(33) + c(43) + c(53) + c(59) + c(67) + c(71) + c(81) + c(83) 'P31
s(122) = c(9) + c(11) + c(21) + c(25) + c(33) + c(39) + c(49) + c(59) + c(65) + c(73) + c(77) + c(87) + c(89)
s(123) = c(81) + c(83) + c(93) + c(97) + c(105) + c(111) + c(121) + c(131) + c(137) + c(145) + c(149) + c(159) + c(161)
s(124) = c(87) + c(89) + c(99) + c(103) + c(111) + c(117) + c(127) + c(137) + c(143) + c(151) + c(155) + c(165) + c(167)

s(125) = c(1) + c(3) + c(5) + c(7) + c(27) + c(33) + c(43) + c(53) + c(59) + c(79) + c(81) + c(83) + c(85)   'P32
s(126) = c(7) + c(9) + c(11) + c(13) + c(33) + c(39) + c(49) + c(59) + c(65) + c(85) + c(87) + c(89) + c(91)
s(127) = c(79) + c(81) + c(83) + c(85) + c(105) + c(111) + c(121) + c(131) + c(137) + c(157) + c(159) + c(161) + c(163)
s(128) = c(85) + c(87) + c(89) + c(91) + c(111) + c(117) + c(127) + c(137) + c(143) + c(163) + c(165) + c(167) + c(169)

s(129) = c(2) + c(6) + c(14) + c(20) + c(30) + c(42) + c(43) + c(44) + c(56) + c(66) + c(72) + c(80) + c(84) 'P33
s(130) = c(8) + c(12) + c(20) + c(26) + c(36) + c(48) + c(49) + c(50) + c(62) + c(72) + c(78) + c(86) + c(90)
s(131) = c(80) + c(84) + c(92) + c(98) + c(108) + c(120) + c(121) + c(122) + c(134) + c(144) + c(150) + c(158) + c(162)
s(132) = c(86) + c(90) + c(98) + c(104) + c(114) + c(126) + c(127) + c(128) + c(140) + c(150) + c(156) + c(164) + c(168)

s(133) = c(2) + c(6) + c(14) + c(17) + c(20) + c(41) + c(43) + c(45) + c(66) + c(69) + c(72) + c(80) + c(84) 'P34
s(134) = c(8) + c(12) + c(20) + c(23) + c(26) + c(47) + c(49) + c(51) + c(72) + c(75) + c(78) + c(86) + c(90)
s(135) = c(80) + c(84) + c(92) + c(95) + c(98) + c(119) + c(121) + c(123) + c(144) + c(147) + c(150) + c(158) + c(162)
s(136) = c(86) + c(90) + c(98) + c(101) + c(104) + c(125) + c(127) + c(129) + c(150) + c(153) + c(156) + c(164) + c(168)

s(137) = c(2) + c(4) + c(6) + c(14) + c(20) + c(40) + c(43) + c(46) + c(66) + c(72) + c(80) + c(82) + c(84)  'P35
s(138) = c(8) + c(10) + c(12) + c(20) + c(26) + c(46) + c(49) + c(52) + c(72) + c(78) + c(86) + c(88) + c(90)
s(139) = c(80) + c(82) + c(84) + c(92) + c(98) + c(118) + c(121) + c(124) + c(144) + c(150) + c(158) + c(160) + c(162)
s(140) = c(86) + c(88) + c(90) + c(98) + c(104) + c(124) + c(127) + c(130) + c(150) + c(156) + c(164) + c(166) + c(168)

s(141) = c(2) + c(6) + c(14) + c(20) + c(29) + c(31) + c(43) + c(55) + c(57) + c(66) + c(72) + c(80) + c(84) 'P36
s(142) = c(8) + c(12) + c(20) + c(26) + c(35) + c(37) + c(49) + c(61) + c(63) + c(72) + c(78) + c(86) + c(90)
s(143) = c(80) + c(84) + c(92) + c(98) + c(107) + c(109) + c(121) + c(133) + c(135) + c(144) + c(150) + c(158) + c(162)
s(144) = c(86) + c(90) + c(98) + c(104) + c(113) + c(115) + c(127) + c(139) + c(141) + c(150) + c(156) + c(164) + c(168)

s(145) = c(2) + c(6) + c(14) + c(15) + c(19) + c(20) + c(43) + c(66) + c(67) + c(71) + c(72) + c(80) + c(84) 'P37
s(146) = c(8) + c(12) + c(20) + c(21) + c(25) + c(26) + c(49) + c(72) + c(73) + c(77) + c(78) + c(86) + c(90)
s(147) = c(80) + c(84) + c(92) + c(93) + c(97) + c(98) + c(121) + c(144) + c(145) + c(149) + c(150) + c(158) + c(162)
s(148) = c(86) + c(90) + c(98) + c(99) + c(103) + c(104) + c(127) + c(150) + c(151) + c(155) + c(156) + c(164) + c(168)

s(149) = c(1) + c(2) + c(6) + c(7) + c(14) + c(20) + c(43) + c(66) + c(72) + c(79) + c(80) + c(84) + c(85)   'P38
s(150) = c(7) + c(8) + c(12) + c(13) + c(20) + c(26) + c(49) + c(72) + c(78) + c(85) + c(86) + c(90) + c(91)
s(151) = c(79) + c(80) + c(84) + c(85) + c(92) + c(98) + c(121) + c(144) + c(150) + c(157) + c(158) + c(162) + c(163)
s(152) = c(85) + c(86) + c(90) + c(91) + c(98) + c(104) + c(127) + c(150) + c(156) + c(163) + c(164) + c(168) + c(169)

'  Type Patterns

For i1 = 1 To 152

    Select Case i1
    
        Case 1, 2, 3, 4: If s(i1) = s1 Then nP(1) = nP(1) + 1
        Case 5, 6, 7, 8: If s(i1) = s1 Then nP(2) = nP(2) + 1
        Case 9, 10, 11, 12: If s(i1) = s1 Then nP(3) = nP(3) + 1
        Case 13, 14, 15, 16: If s(i1) = s1 Then nP(4) = nP(4) + 1
        Case 17, 18, 19, 20: If s(i1) = s1 Then nP(5) = nP(5) + 1
        Case 21, 22, 23, 24: If s(i1) = s1 Then nP(6) = nP(6) + 1
        Case 25, 26, 27, 28: If s(i1) = s1 Then nP(7) = nP(7) + 1
        Case 29, 30, 31, 32: If s(i1) = s1 Then nP(8) = nP(8) + 1
        Case 33, 34, 35, 36: If s(i1) = s1 Then nP(9) = nP(9) + 1
        Case 37, 38, 39, 40: If s(i1) = s1 Then nP(10) = nP(10) + 1
        Case 41, 42, 43, 44: If s(i1) = s1 Then nP(11) = nP(11) + 1
        Case 45, 46, 47, 48: If s(i1) = s1 Then nP(12) = nP(12) + 1
        Case 49, 50, 51, 52: If s(i1) = s1 Then nP(13) = nP(13) + 1
        Case 53, 54, 55, 56: If s(i1) = s1 Then nP(14) = nP(14) + 1
        Case 57, 58, 59, 60: If s(i1) = s1 Then nP(15) = nP(15) + 1
        Case 61, 62, 63, 64: If s(i1) = s1 Then nP(16) = nP(16) + 1
        Case 65, 66, 67, 68: If s(i1) = s1 Then nP(17) = nP(17) + 1
        Case 69, 70, 71, 72: If s(i1) = s1 Then nP(18) = nP(18) + 1
        Case 73, 74, 75, 76: If s(i1) = s1 Then nP(19) = nP(19) + 1
        Case 77, 78, 79, 80: If s(i1) = s1 Then nP(20) = nP(20) + 1
        Case 81, 82, 83, 84: If s(i1) = s1 Then nP(21) = nP(21) + 1
        Case 85, 86, 87, 88: If s(i1) = s1 Then nP(22) = nP(22) + 1
        Case 89, 90, 91, 92: If s(i1) = s1 Then nP(23) = nP(23) + 1
        Case 93, 94, 95, 96: If s(i1) = s1 Then nP(24) = nP(24) + 1
        Case 97, 98, 99, 100: If s(i1) = s1 Then nP(25) = nP(25) + 1
        Case 101, 102, 103, 104: If s(i1) = s1 Then nP(26) = nP(26) + 1
        Case 105, 106, 107, 108: If s(i1) = s1 Then nP(27) = nP(27) + 1
        Case 109, 110, 111, 112: If s(i1) = s1 Then nP(28) = nP(28) + 1
        Case 113, 114, 115, 116: If s(i1) = s1 Then nP(29) = nP(29) + 1
        Case 117, 118, 119, 120: If s(i1) = s1 Then nP(30) = nP(30) + 1
        Case 121, 122, 123, 124: If s(i1) = s1 Then nP(31) = nP(31) + 1
        Case 125, 126, 127, 128: If s(i1) = s1 Then nP(32) = nP(32) + 1
        Case 129, 130, 131, 132: If s(i1) = s1 Then nP(33) = nP(33) + 1
        Case 133, 134, 135, 136: If s(i1) = s1 Then nP(34) = nP(34) + 1
        Case 137, 138, 139, 140: If s(i1) = s1 Then nP(35) = nP(35) + 1
        Case 141, 142, 143, 144: If s(i1) = s1 Then nP(36) = nP(36) + 1
        Case 145, 146, 147, 148: If s(i1) = s1 Then nP(37) = nP(37) + 1
        Case 149, 150, 151, 152: If s(i1) = s1 Then nP(38) = nP(38) + 1
    
    End Select
    
    If s(i1) = s1 Then nQ = nQ + 1    ' Total Patterns

Next i1

nStr13 = ""
For i1 = 1 To 38
    If nP(i1) <> 0 Then
        nStr13 = nStr13 + "P" + CStr(i1) + "=" + CStr(nP(i1)) + " "
    End If
Next i1

Return

'    Print results (squares)

2650 n2 = n2 + 1
     If n2 = 2 Then
         n2 = 1: k1 = k1 + 14: k2 = 1
     Else
         If n9 > 1 Then k2 = k2 + 14
     End If
       
     Cells(1, 1).Value = n9
     Cells(k1, k2 + 1).Font.Color = -4165632
     Cells(k1, k2 + 1).Value = n9
     Cells(k1, k2 + 2).Font.Color = -4165632
     Cells(k1, k2 + 2).Value = nQ
     
     Cells(k1, k2 + 3).Value = nStr13
     
     i3 = 0
     For i1 = 1 To 13
         For i2 = 1 To 13
             i3 = i3 + 1
             Cells(k1 + i1, k2 + i2).Value = c(i3)
         Next i2
     Next i1
    
     Return

End Sub

Vorige Pagina About the Author