Vorige Pagina About the Author

' Constructs 13 x 13 Associated Magic Squares (Distinct Prime Numbers)
' Associated Magic Diamond Inlays Order 6 and 7

' Tested with Office 365 under Windows 10

Sub AssBrd13()

Dim a1(2448), a(169), b1(43300), b(43300), c(169)
 
    y = MsgBox("Locked", vbCritical, "Routine AssBrd13")
    End

    Sheets("Klad1").Select

    n5 = 0: n9 = 0: k1 = 1: k2 = 1
 
    Sheets("Klad1").Select
    
    t1 = Timer

For j150 = 1051 To 2063                             'Read Diamond Inlays (Prime Numbers)
Cells(1, 1).Value = j150

    s1 = Sheets("DiaLns67").Cells(j150, 170):
    j100 = Sheets("DiaLns67").Cells(j150, 171):
    
'   Define variables

    p2 = Sheets("Pairs7").Cells(j100, 1).Value      'Pair Sum
    s1 = 13 * p2 / 2
    s3 = 3 * p2 / 2
    s4 = 2 * p2
    nVar1 = Sheets("Pairs7").Cells(j100, 9).Value
    
    Erase b1
    For i1 = 1 To nVar1
        x = Sheets("Pairs7").Cells(j100, 9 + i1).Value
        b1(x) = x
    Next i1
    Pmin = Sheets("Pairs7").Cells(j100, 10).Value
    Pmax = Sheets("Pairs7").Cells(j100, 9 + nVar1).Value
    
    For i1 = 1 To 169
        a(i1) = Sheets("DiaLns67").Cells(j150, i1).Value
        b1(a(i1)) = 0                               'Remove used primes
    Next i1
    
    i2 = 0
    For i1 = Pmin To Pmax
        If b1(i1) <> 0 Then
           i2 = i2 + 1: a1(i2) = i1
        End If
    Next i1
    m1 = 1: m2 = i2
    If a1(1) = 1 Then m1 = m1 + 1: m2 = m2 - 1

    t11 = Timer                                                   'Time Out
    
    For j164 = m1 To m2
    If b(a1(j164)) = 0 Then b(a1(j164)) = a1(j164): c(164) = a1(j164) Else GoTo 1640
    a(164) = a1(j164)

    a(6) = p2 - a(164): If b(a(6)) = 0 Then b(a(6)) = a(6): c(6) = a(6) Else GoTo 60

    a(162) = s1 - a(6) - a(19) - a(32) - a(45) - a(58) - a(71) - a(84) - a(97) - a(110) - a(123) - a(136) - a(149)
    If a(162) < a1(m1) Or a(162) > a1(m2) Then GoTo 1620:
    If b1(a(162)) = 0 Then GoTo 1620
    If b(a(162)) = 0 Then b(a(162)) = a(162): c(162) = a(162) Else GoTo 1620
   
    a(8) = p2 - a(162): If b(a(8)) = 0 Then b(a(8)) = a(8): c(8) = a(8) Else GoTo 80

    For j165 = m1 To m2
    If b(a1(j165)) = 0 Then b(a1(j165)) = a1(j165): c(165) = a1(j165) Else GoTo 1650
    a(165) = a1(j165)
    
    a(5) = p2 - a(165): If b(a(5)) = 0 Then b(a(5)) = a(5): c(5) = a(5) Else GoTo 50
    
    a(161) = 5 * s1 / 13 - a(162) - a(163) - a(164) - a(165)
    If a(161) < a1(m1) Or a(161) > a1(m2) Then GoTo 1610:
    If b1(a(161)) = 0 Then GoTo 1610
    If b(a(161)) = 0 Then b(a(161)) = a(161): c(161) = a(161) Else GoTo 1610
    
    a(9) = p2 - a(161): If b(a(9)) = 0 Then b(a(9)) = a(9): c(9) = a(9) Else GoTo 90

    For j152 = m1 To m2
    If b(a1(j152)) = 0 Then b(a1(j152)) = a1(j152): c(152) = a1(j152) Else GoTo 1520
    a(152) = a1(j152)

    a(18) = p2 - a(152): If b(a(18)) = 0 Then b(a(18)) = a(18): c(18) = a(18) Else GoTo 180

    a(148) = s1 - a(5) - a(18) - a(31) - a(44) - a(57) - a(70) - a(83) - a(96) - a(109) - a(122) - a(135) - a(161)
    If a(148) < a1(m1) Or a(148) > a1(m2) Then GoTo 1480:
    If b1(a(148)) = 0 Then GoTo 1480
    If b(a(148)) = 0 Then b(a(148)) = a(148): c(148) = a(148) Else GoTo 1480
   
    a(22) = p2 - a(148): If b(a(22)) = 0 Then b(a(22)) = a(22): c(22) = a(22) Else GoTo 220

    For j104 = m1 To m2
    If b(a1(j104)) = 0 Then b(a1(j104)) = a1(j104): c(104) = a1(j104) Else GoTo 1040
    a(104) = a1(j104)

    a(66) = p2 - a(104): If b(a(66)) = 0 Then b(a(66)) = a(66): c(66) = a(66) Else GoTo 660
    
    a(78) = s1 - a(66) - a(67) - a(68) - a(69) - a(70) - a(71) - a(72) - a(73) - a(74) - a(75) - a(76) - a(77)
    If a(78) < a1(m1) Or a(78) > a1(m2) Then GoTo 780:
    If b1(a(78)) = 0 Then GoTo 780
    If b(a(78)) = 0 Then b(a(78)) = a(78): c(78) = a(78) Else GoTo 780
    
    a(92) = p2 - a(78): If b(a(92)) = 0 Then b(a(92)) = a(92): c(92) = a(92) Else GoTo 920

    For j65 = m2 To m1 Step -1
    If b(a1(j65)) = 0 Then b(a1(j65)) = a1(j65): c(65) = a1(j65) Else GoTo 650
    a(65) = a1(j65)
    
    a(105) = p2 - a(65): If b(a(105)) = 0 Then b(a(105)) = a(105): c(105) = a(105) Else GoTo 50
    
    For j117 = m1 To m2
    If b(a1(j117)) = 0 Then b(a1(j117)) = a1(j117): c(117) = a1(j117) Else GoTo 1170
    a(117) = a1(j117)
    
    a(53) = p2 - a(117): If b(a(53)) = 0 Then b(a(53)) = a(53): c(53) = a(53) Else GoTo 530

    For j64 = m1 To m2
    If b(a1(j64)) = 0 Then b(a1(j64)) = a1(j64): c(64) = a1(j64) Else GoTo 640
    a(64) = a1(j64)

    a(106) = p2 - a(64): If b(a(106)) = 0 Then b(a(106)) = a(106): c(106) = a(106) Else GoTo 1060

    a(116) = s1 - a(105) - a(106) - a(107) - a(108) - a(109) - a(110) - a(111) - a(112) - a(113) - a(114) - a(115) - a(117)
    If a(116) < a1(m1) Or a(116) > a1(m2) Then GoTo 1160:
    If b1(a(116)) = 0 Then GoTo 1160
    If b(a(116)) = 0 Then b(a(116)) = a(116): c(116) = a(116) Else GoTo 1160
   
    a(54) = p2 - a(116): If b(a(54)) = 0 Then b(a(54)) = a(54): c(54) = a(54) Else GoTo 540

    For j169 = m2 To m1 Step -1
    If b(a1(j169)) = 0 Then b(a1(j169)) = a1(j169): c(169) = a1(j169) Else GoTo 1690
    a(169) = a1(j169)
    
    a(1) = p2 - a(169): If b(a(1)) = 0 Then b(a(1)) = a(1): c(1) = a(1) Else GoTo 10
    
    For j168 = m1 To m2
    If b(a1(j168)) = 0 Then b(a1(j168)) = a1(j168): c(168) = a1(j168) Else GoTo 1680
    a(168) = a1(j168)
    
    a(2) = p2 - a(168): If b(a(2)) = 0 Then b(a(2)) = a(2): c(2) = a(2) Else GoTo 20

    For j167 = m1 To m2
    If b(a1(j167)) = 0 Then b(a1(j167)) = a1(j167): c(167) = a1(j167) Else GoTo 1670
    a(167) = a1(j167)
   
    a(3) = p2 - a(167): If b(a(3)) = 0 Then b(a(3)) = a(3): c(3) = a(3) Else GoTo 30

    a(166) = s4 - a(167) - a(168) - a(169)
    If a(166) < a1(m1) Or a(166) > a1(m2) Then GoTo 1660:
    If b1(a(166)) = 0 Then GoTo 1660
    If b(a(166)) = 0 Then b(a(166)) = a(166): c(166) = a(166) Else GoTo 1660
    
    a(4) = p2 - a(166): If b(a(4)) = 0 Then b(a(4)) = a(4): c(4) = a(4) Else GoTo 40

    For j156 = m1 To m2
    If b(a1(j156)) = 0 Then b(a1(j156)) = a1(j156): c(156) = a1(j156) Else GoTo 1560
    a(156) = a1(j156)
    
    a(14) = p2 - a(156): If b(a(14)) = 0 Then b(a(14)) = a(14): c(14) = a(14) Else GoTo 140

    For j143 = m1 To m2
    If b(a1(j143)) = 0 Then b(a1(j143)) = a1(j143): c(143) = a1(j143) Else GoTo 1430
    a(143) = a1(j143)
   
    a(27) = p2 - a(143): If b(a(27)) = 0 Then b(a(27)) = a(27): c(27) = a(27) Else GoTo 270

    a(130) = s4 - a(143) - a(156) - a(169)
    If a(130) < a1(m1) Or a(130) > a1(m2) Then GoTo 1300:
    If b1(a(130)) = 0 Then GoTo 1300
    If b(a(130)) = 0 Then b(a(130)) = a(130): c(130) = a(130) Else GoTo 1300
    
    a(40) = p2 - a(130): If b(a(40)) = 0 Then b(a(40)) = a(40): c(40) = a(40) Else GoTo 400

    For j155 = m2 To m1 Step -1
    If b(a1(j155)) = 0 Then b(a1(j155)) = a1(j155): c(155) = a1(j155) Else GoTo 1550
    a(155) = a1(j155)
    
    a(15) = p2 - a(155): If b(a(15)) = 0 Then b(a(15)) = a(15): c(15) = a(15) Else GoTo 150
    
    For j154 = m1 To m2
    If b(a1(j154)) = 0 Then b(a1(j154)) = a1(j154): c(154) = a1(j154) Else GoTo 1540
    a(154) = a1(j154)
    
    a(16) = p2 - a(154): If b(a(16)) = 0 Then b(a(16)) = a(16): c(16) = a(16) Else GoTo 160
     
    a(153) = s4 - a(154) - a(155) - a(156)
    If a(153) < a1(m1) Or a(153) > a1(m2) Then GoTo 1530:
    If b1(a(153)) = 0 Then GoTo 1530
    If b(a(153)) = 0 Then b(a(153)) = a(153): c(153) = a(153) Else GoTo 1530
    
    a(17) = p2 - a(153): If b(a(17)) = 0 Then b(a(17)) = a(17): c(17) = a(17) Else GoTo 170

    For j142 = m1 To m2
    If b(a1(j142)) = 0 Then b(a1(j142)) = a1(j142): c(142) = a1(j142) Else GoTo 1420
    a(142) = a1(j142)
    
    a(28) = p2 - a(142): If b(a(28)) = 0 Then b(a(28)) = a(28): c(28) = a(28) Else GoTo 280

    a(129) = s4 - a(142) - a(155) - a(168)
    If a(129) < a1(m1) Or a(129) > a1(m2) Then GoTo 1290:
    If b1(a(129)) = 0 Then GoTo 1290
    If b(a(129)) = 0 Then b(a(129)) = a(129): c(129) = a(129) Else GoTo 1290
   
    a(41) = p2 - a(129): If b(a(41)) = 0 Then b(a(41)) = a(41): c(41) = a(41) Else GoTo 410

    For j157 = m2 To m1 Step -1
    If b(a1(j157)) = 0 Then b(a1(j157)) = a1(j157): c(157) = a1(j157) Else GoTo 1570
    a(157) = a1(j157)
    
    a(13) = p2 - a(157): If b(a(13)) = 0 Then b(a(13)) = a(13): c(13) = a(13) Else GoTo 130
    
    For j158 = m1 To m2
    If b(a1(j158)) = 0 Then b(a1(j158)) = a1(j158): c(158) = a1(j158) Else GoTo 1580
    a(158) = a1(j158)
    
    a(12) = p2 - a(158): If b(a(12)) = 0 Then b(a(12)) = a(12): c(12) = a(12) Else GoTo 120

    For j159 = m1 To m2
    If b(a1(j159)) = 0 Then b(a1(j159)) = a1(j159): c(159) = a1(j159) Else GoTo 1590
    a(159) = a1(j159)
   
    a(11) = p2 - a(159): If b(a(11)) = 0 Then b(a(11)) = a(11): c(11) = a(11) Else GoTo 110

    a(160) = s4 - a(159) - a(158) - a(157)
    If a(160) < a1(m1) Or a(160) > a1(m2) Then GoTo 1600:
    If b1(a(160)) = 0 Then GoTo 1600
    If b(a(160)) = 0 Then b(a(160)) = a(160): c(160) = a(160) Else GoTo 1600
    
    a(10) = p2 - a(160): If b(a(10)) = 0 Then b(a(10)) = a(10): c(10) = a(10) Else GoTo 100

    t12 = Timer: t13 = t12 - t11                                   'Time Out
    If t13 > 60 Then Erase b, c: GoTo 1500                        'Time Out, Try Next

    For j144 = m1 To m2
    If b(a1(j144)) = 0 Then b(a1(j144)) = a1(j144): c(144) = a1(j144) Else GoTo 1440
    a(144) = a1(j144)
    
    a(26) = p2 - a(144): If b(a(26)) = 0 Then b(a(26)) = a(26): c(26) = a(26) Else GoTo 260

    For j131 = m1 To m2
    If b(a1(j131)) = 0 Then b(a1(j131)) = a1(j131): c(131) = a1(j131) Else GoTo 1310
    a(131) = a1(j131)
   
    a(39) = p2 - a(131): If b(a(39)) = 0 Then b(a(39)) = a(39): c(39) = a(39) Else GoTo 390

    a(118) = s1 - a(1) - a(14) - a(27) - a(40) - a(53) - a(66) - a(79) - a(92) - a(105) - a(131) - a(144) - a(157)
    If a(118) < a1(m1) Or a(118) > a1(m2) Then GoTo 1180:
    If b1(a(118)) = 0 Then GoTo 1180
    If b(a(118)) = 0 Then b(a(118)) = a(118): c(118) = a(118) Else GoTo 1180
    
    a(52) = p2 - a(118): If b(a(52)) = 0 Then b(a(52)) = a(52): c(52) = a(52) Else GoTo 520

    For j145 = m2 To m1 Step -1
    If b(a1(j145)) = 0 Then b(a1(j145)) = a1(j145): c(145) = a1(j145) Else GoTo 1450
    a(145) = a1(j145)
    
    a(25) = p2 - a(145): If b(a(25)) = 0 Then b(a(25)) = a(25): c(25) = a(25) Else GoTo 250
    
    For j146 = m1 To m2
    If b(a1(j146)) = 0 Then b(a1(j146)) = a1(j146): c(146) = a1(j146) Else GoTo 1460
    a(146) = a1(j146)
    
    a(24) = p2 - a(146): If b(a(24)) = 0 Then b(a(24)) = a(24): c(24) = a(24) Else GoTo 240
     
    a(147) = s1 - a(144) - a(145) - a(146) - a(148) - a(149) - a(150) - a(151) - a(152) - a(153) - a(154) - a(155) - a(156)
    If a(147) < a1(m1) Or a(147) > a1(m2) Then GoTo 1470:
    If b1(a(147)) = 0 Then GoTo 1470
    If b(a(147)) = 0 Then b(a(147)) = a(147): c(147) = a(147) Else GoTo 1470
    
    a(23) = p2 - a(147): If b(a(23)) = 0 Then b(a(23)) = a(23): c(23) = a(23) Else GoTo 230

    For j132 = m1 To m2
    If b(a1(j132)) = 0 Then b(a1(j132)) = a1(j132): c(132) = a1(j132) Else GoTo 1320
    a(132) = a1(j132)
    
    a(38) = p2 - a(132): If b(a(38)) = 0 Then b(a(38)) = a(38): c(38) = a(38) Else GoTo 380

    a(119) = s1 - a(2) - a(15) - a(28) - a(41) - a(54) - a(67) - a(80) - a(93) - a(106) - a(132) - a(145) - a(158)
    If a(119) < a1(m1) Or a(119) > a1(m2) Then GoTo 1190:
    If b1(a(119)) = 0 Then GoTo 1190
    If b(a(119)) = 0 Then b(a(119)) = a(119): c(119) = a(119) Else GoTo 1190
   
    a(51) = p2 - a(119): If b(a(51)) = 0 Then b(a(51)) = a(51): c(51) = a(51) Else GoTo 510

    For j128 = m1 To m2
    If b(a1(j128)) = 0 Then b(a1(j128)) = a1(j128): c(128) = a1(j128) Else GoTo 1280
    a(128) = a1(j128)

    a(42) = p2 - a(128): If b(a(42)) = 0 Then b(a(42)) = a(42): c(42) = a(42) Else GoTo 420
    
    a(50) = s1 - a(40) - a(41) - a(42) - a(43) - a(44) - a(45) - a(46) - a(47) - a(48) - a(49) - a(51) - a(52)
    If a(50) < a1(m1) Or a(50) > a1(m2) Then GoTo 500:
    If b1(a(50)) = 0 Then GoTo 500
    If b(a(50)) = 0 Then b(a(50)) = a(50): c(50) = a(50) Else GoTo 500
    
    a(120) = p2 - a(50): If b(a(120)) = 0 Then b(a(120)) = a(120): c(120) = a(120) Else GoTo 1200

    For j141 = m2 To m1 Step -1
    If b(a1(j141)) = 0 Then b(a1(j141)) = a1(j141): c(141) = a1(j141) Else GoTo 1410
    a(141) = a1(j141)

    a(29) = p2 - a(141): If b(a(29)) = 0 Then b(a(29)) = a(29): c(29) = a(29) Else GoTo 290

    a(133) = s1 - a(3) - a(16) - a(29) - a(42) - a(55) - a(68) - a(81) - a(94) - a(107) - a(120) - a(146) - a(159)
    If a(133) < a1(m1) Or a(133) > a1(m2) Then GoTo 1330:
    If b1(a(133)) = 0 Then GoTo 1330
    If b(a(133)) = 0 Then b(a(133)) = a(133): c(133) = a(133) Else GoTo 1330
   
    a(37) = p2 - a(133): If b(a(37)) = 0 Then b(a(37)) = a(37): c(37) = a(37) Else GoTo 370

    rw3 = a(27) + a(28) + a(29) + a(31) + a(32) + a(33) + a(34) + a(35) + a(37) + a(38) + a(39)
    If rw3 > s1 Then GoTo 5

    a(140) = (2 * s1 / 13 - a(10) - a(23) + a(27) + a(28) + a(29) + a(31) + a(32) + a(33) + a(34) + a(35) + a(37) + 
                      + a(38) + a(39) - a(49) - a(62) - a(75) - a(88) - a(101) - a(114) - a(127) - a(153) - a(166)) / 2

    If a(140) < a1(m1) Or a(140) > a1(m2) Or CInt(a(140)) <> a(140) Then GoTo 1400:
    If b1(a(140)) = 0 Then GoTo 1400
    If b(a(140)) = 0 Then b(a(140)) = a(140): c(140) = a(140) Else GoTo 1400

    a(30) = p2 - a(140): If b(a(30)) = 0 Then b(a(30)) = a(30): c(30) = a(30) Else GoTo 300

    a(134) = s1 - a(140) - a(131) - a(132) - a(133) - a(135) - a(136) - a(137) - a(138) - a(139) - a(141) - a(142) - a(143)
    If a(134) < a1(m1) Or a(134) > a1(m2) Then GoTo 1340:
    If b1(a(134)) = 0 Then GoTo 1340
    If b(a(134)) = 0 Then b(a(134)) = a(134): c(134) = a(134) Else GoTo 1340

    a(36) = p2 - a(134): If b(a(36)) = 0 Then b(a(36)) = a(36): c(36) = a(36) Else GoTo 360


'                               Exclude solutions with identical numbers

                                GoSub 1800: If fl1 = 0 Then GoTo 5
    
                                n9 = n9 + 1
                                GoSub 2650              'Print results (squares)
 '                              GoSub 2645              'Print results (selected numbers)

                                Erase b, c: GoTo 1500   'Print only first square
5

     b(c(36)) = 0: c(36) = 0
360  b(c(134)) = 0: c(134) = 0
1340
     b(c(30)) = 0: c(30) = 0
300  b(c(140)) = 0: c(140) = 0
1400
     
     b(c(37)) = 0: c(37) = 0
370  b(c(133)) = 0: c(133) = 0
1330 b(c(29)) = 0: c(29) = 0
290  b(c(141)) = 0: c(141) = 0
1410 Next j141

      b(c(120)) = 0: c(120) = 0
1200  b(c(50)) = 0: c(50) = 0
500   b(c(42)) = 0: c(42) = 0
420   b(c(128)) = 0: c(128) = 0
1280  Next j128

     b(c(51)) = 0: c(51) = 0
510  b(c(119)) = 0: c(119) = 0
1190 b(c(38)) = 0: c(38) = 0
380  b(c(132)) = 0: c(132) = 0
1320 Next j132

     b(c(23)) = 0: c(23) = 0
230  b(c(147)) = 0: c(147) = 0
1470 b(c(24)) = 0: c(24) = 0
240  b(c(146)) = 0: c(146) = 0
1460 Next j146
     
     b(c(25)) = 0: c(25) = 0
250  b(c(145)) = 0: c(145) = 0
1450 Next j145

     b(c(52)) = 0: c(52) = 0
520  b(c(118)) = 0: c(118) = 0
1180 b(c(39)) = 0: c(39) = 0
390  b(c(131)) = 0: c(131) = 0
1310 Next j131

     b(c(26)) = 0: c(26) = 0
260  b(c(144)) = 0: c(144) = 0
1440 Next j144

     b(c(10)) = 0: c(10) = 0
100  b(c(160)) = 0: c(160) = 0
1600 b(c(11)) = 0: c(11) = 0
110  b(c(159)) = 0: c(159) = 0
1590 Next j159

     b(c(12)) = 0: c(12) = 0
120  b(c(158)) = 0: c(158) = 0
1580 Next j158
     
     b(c(13)) = 0: c(13) = 0
130  b(c(157)) = 0: c(157) = 0
1570 Next j157

     b(c(41)) = 0: c(41) = 0
410  b(c(129)) = 0: c(129) = 0
1290 b(c(28)) = 0: c(28) = 0
280  b(c(142)) = 0: c(142) = 0
1420 Next j142

     b(c(17)) = 0: c(17) = 0
170  b(c(153)) = 0: c(153) = 0
1530 b(c(16)) = 0: c(16) = 0
160  b(c(154)) = 0: c(154) = 0
1540 Next j154
     
     b(c(15)) = 0: c(15) = 0
150  b(c(155)) = 0: c(155) = 0
1550 Next j155

     b(c(40)) = 0: c(40) = 0
400  b(c(130)) = 0: c(130) = 0
1300 b(c(27)) = 0: c(27) = 0
270  b(c(143)) = 0: c(143) = 0
1430 Next j143

     b(c(14)) = 0: c(14) = 0
140  b(c(156)) = 0: c(156) = 0
1560 Next j156

     b(c(4)) = 0: c(4) = 0
40   b(c(166)) = 0: c(166) = 0
1660 b(c(3)) = 0: c(3) = 0
30   b(c(167)) = 0: c(167) = 0
1670 Next j167

     b(c(2)) = 0: c(2) = 0
20   b(c(168)) = 0: c(168) = 0
1680 Next j168
     
     b(c(1)) = 0: c(1) = 0
10   b(c(169)) = 0: c(169) = 0
1690 Next j169

     b(c(54)) = 0: c(54) = 0
540  b(c(116)) = 0: c(116) = 0
1160 b(c(106)) = 0: c(106) = 0
1060 b(c(64)) = 0: c(64) = 0
640  Next j64

     b(c(53)) = 0: c(53) = 0
530  b(c(117)) = 0: c(117) = 0
1170 Next j117
     
     b(c(105)) = 0: c(105) = 0
1050 b(c(65)) = 0: c(65) = 0
650  Next j65

      b(c(92)) = 0: c(92) = 0
920   b(c(78)) = 0: c(78) = 0
780   b(c(66)) = 0: c(66) = 0
660   b(c(104)) = 0: c(104) = 0
1040  Next j104

     b(c(22)) = 0: c(22) = 0
220  b(c(148)) = 0: c(148) = 0
1480 b(c(18)) = 0: c(18) = 0
180  b(c(152)) = 0: c(152) = 0
1520 Next j152

     b(c(9)) = 0: c(9) = 0
90   b(c(161)) = 0: c(161) = 0
1610 b(c(5)) = 0: c(5) = 0
50   b(c(165)) = 0: c(165) = 0
1650 Next j165

     b(c(8)) = 0: c(8) = 0
80   b(c(162)) = 0: c(162) = 0
1620 b(c(6)) = 0: c(6) = 0
60   b(c(164)) = 0: c(164) = 0
1640 Next j164
     
     Sheets("DiaLns67").Cells(j150, 172).Value = "no"

1500 Next j150

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

End

'    Double Check Identical Numbers a()

1800 fl1 = 1
     For i1 = 1 To 169
        a20 = a(i1): If a20 = 0 Then GoTo 1810
        For i2 = (1 + i1) To 169
            If a20 = a(i2) Then fl1 = 0: Return
        Next i2
1810 Next i1
     Return

'   Print results (selected numbers)

2645 For i1 = 1 To 169
         Cells(n9, i1).Value = a(i1)
     Next i1
     Cells(n9, 170).Value = n9
     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(2, 1).Value = n9
     Cells(k1, k2 + 1).Font.Color = -4165632
     Cells(k1, k2 + 1).Value = CStr(s1)
     Cells(k1, k2 + 2).Value = j150
   
     Sheets("DiaLns67").Cells(j150, 172).Value = "ok"
   
     i3 = 0
     For i1 = 1 To 13
         For i2 = 1 To 13
         i3 = i3 + 1
             Cells(k1 + i1, k2 + i2).Value = a(i3)
         Next i2
     Next i1

     Return

End Sub

Vorige Pagina About the Author