Vorige Pagina Volgende Pagina About the Author

' Generates Bordered Magic Cubes of order 7 (Prime Numbers)
' Part II: Anti Symmetric Magic Back Squares (c)

' Tested with Office 365 under Windows 10

Sub PrimeCubes71c()

Dim a1(724), a(100), b1(43291), b(43291), c(100), a7(49), c7(343)

y = MsgBox("Locked", vbCritical, "Routine PrimeCubes71c")
End

    n2 = 0: n9 = 0: k1 = 1: k2 = 1
    ShtNm1 = "Pairs77"
    ShtNm2 = "TopSqrs7"
    
    Sheets("Klad1").Select
    
    t1 = Timer

For j100 = 181 To 181 ''173 To 175

'   Start Reading Data ShtNm2

    Rcrd1a = Sheets(ShtNm2).Cells(j100, 51).Value
    MC7 = Sheets(ShtNm2).Cells(j100, 50).Value

'   Read Available Prime Numbers From Sheet ShtNm1

    GoSub 2015

'   Define Back Square

    Erase a                            'Clear Scratch Areas
    For i1 = 1 To 7
        a(i1) = c7(i1): a(i1 + 42) = c7(i1 + 294)
    Next i1
   
    b(Cntr7) = Cntr7                   'Block Center Element

    t11 = Timer                                                 'Time Out

    For j42 = (m2 - 1) / 2 To m1 Step -1                        'a(42)
    If b1(a1(j42)) = 0 Then GoTo 420
    If b(a1(j42)) = 0 Then b(a1(j42)) = a1(j42): c(42) = a1(j42) Else GoTo 420
    a(42) = a1(j42)

    a(92) = Pr7 - a(42): If b(a(92)) = 0 Then b(a(92)) = a(92): c(92) = a(92) Else GoTo 920

    For j41 = m1 To m2                                          'a(41)
    If b1(a1(j41)) = 0 Then GoTo 410
    If b(a1(j41)) = 0 Then b(a1(j41)) = a1(j41): c(41) = a1(j41) Else GoTo 410
    a(41) = a1(j41)
   
    a(91) = Pr7 - a(41): If b(a(91)) = 0 Then b(a(91)) = a(91): c(91) = a(91) Else GoTo 910

    a(40) = s3 - a(41) - a(42)
    If a(40) < a1(m1) Or a(40) > a1(m2) Then GoTo 400
    If b1(a(40)) = 0 Then GoTo 400
    If b(a(40)) = 0 Then b(a(40)) = a(40): c(40) = a(40) Else GoTo 400
    
    a(90) = Pr7 - a(40): If b(a(90)) = 0 Then b(a(90)) = a(90): c(90) = a(90) Else GoTo 900
    
    For j35 = m1 To m2                                          'a(35)
    If b1(a1(j35)) = 0 Then GoTo 350
    If b(a1(j35)) = 0 Then b(a1(j35)) = a1(j35): c(35) = a1(j35) Else GoTo 350
    a(35) = a1(j35)
    
    a(85) = Pr7 - a(35): If b(a(85)) = 0 Then b(a(85)) = a(85): c(85) = a(85) Else GoTo 850

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

    For j34 = m1 To m2                                          'a(34)
    If b1(a1(j34)) = 0 Then GoTo 340
    If b(a1(j34)) = 0 Then b(a1(j34)) = a1(j34): c(34) = a1(j34) Else GoTo 340
    a(34) = a1(j34)
   
    a(84) = Pr7 - a(34): If b(a(84)) = 0 Then b(a(84)) = a(84): c(84) = a(84) Else GoTo 840

    a(33) = s3 - a(34) - a(35)
    If a(33) < a1(m1) Or a(33) > a1(m2) Then GoTo 330
    If b1(a(33)) = 0 Then GoTo 330
    If b(a(33)) = 0 Then b(a(33)) = a(33): c(33) = a(33) Else GoTo 330
    
    a(83) = Pr7 - a(33): If b(a(83)) = 0 Then b(a(83)) = a(83): c(83) = a(83) Else GoTo 830

    For j28 = m1 To m2                                          'a(28)
    If b1(a1(j28)) = 0 Then GoTo 280
    If b(a1(j28)) = 0 Then b(a1(j28)) = a1(j28): c(28) = a1(j28) Else GoTo 280
    a(28) = a1(j28)
   
    a(78) = Pr7 - a(28): If b(a(78)) = 0 Then b(a(78)) = a(78): c(78) = a(78) Else GoTo 780

    For j27 = m1 To m2                                          'a(27)
    If b1(a1(j27)) = 0 Then GoTo 263
    If b(a1(j27)) = 0 Then b(a1(j27)) = a1(j27): c(27) = a1(j27) Else GoTo 263
    a(27) = a1(j27)
   
    a(77) = Pr7 - a(27): If b(a(77)) = 0 Then b(a(77)) = a(77): c(77) = a(77) Else GoTo 770

    a(26) = s3 - a(27) - a(28)
    If a(26) < a1(m1) Or a(26) > a1(m2) Then GoTo 260
    If b1(a(26)) = 0 Then GoTo 260
    If b(a(26)) = 0 Then b(a(26)) = a(26): c(26) = a(26) Else GoTo 260
    
    a(76) = Pr7 - a(26): If b(a(76)) = 0 Then b(a(76)) = a(76): c(76) = a(76) Else GoTo 760

    For j21 = m1 To m2                                          'a(21)
    If b1(a1(j21)) = 0 Then GoTo 210
    If b(a1(j21)) = 0 Then b(a1(j21)) = a1(j21): c(21) = a1(j21) Else GoTo 210
    a(21) = a1(j21)
   
    a(71) = Pr7 - a(21): If b(a(71)) = 0 Then b(a(71)) = a(71): c(71) = a(71) Else GoTo 710

    a(14) = s7 - a(7) - a(21) - a(28) - a(35) - a(42) - a(49)
    If a(14) < a1(m1) Or a(14) > a1(m2) Then GoTo 140
    If b1(a(14)) = 0 Then GoTo 140
    If b(a(14)) = 0 Then b(a(14)) = a(14): c(14) = a(14) Else GoTo 140
    
    a(64) = Pr7 - a(14): If b(a(64)) = 0 Then b(a(64)) = a(64): c(64) = a(64) Else GoTo 640

    For j20 = m1 To m2                                          'a(20)
    If b1(a1(j20)) = 0 Then GoTo 193
    If b(a1(j20)) = 0 Then b(a1(j20)) = a1(j20): c(20) = a1(j20) Else GoTo 193
    a(20) = a1(j20)
   
    a(70) = Pr7 - a(20): If b(a(70)) = 0 Then b(a(70)) = a(70): c(70) = a(70) Else GoTo 700

    a(19) = s3 - a(20) - a(21)
    If a(19) < a1(m1) Or a(19) > a1(m2) Then GoTo 190
    If b1(a(19)) = 0 Then GoTo 190
    If b(a(19)) = 0 Then b(a(19)) = a(19): c(19) = a(19) Else GoTo 190
    
    a(69) = Pr7 - a(19): If b(a(69)) = 0 Then b(a(69)) = a(69): c(69) = a(69) Else GoTo 690

    a(13) = s7 - a(6) - a(20) - a(27) - a(34) - a(41) - a(48)
    If a(13) < a1(m1) Or a(13) > a1(m2) Then GoTo 130
    If b1(a(13)) = 0 Then GoTo 130
    If b(a(13)) = 0 Then b(a(13)) = a(13): c(13) = a(13) Else GoTo 130
    
    a(63) = Pr7 - a(13): If b(a(63)) = 0 Then b(a(63)) = a(63): c(63) = a(63) Else GoTo 630
   
    a(12) = s7 - a(5) - a(19) - a(26) - a(33) - a(40) - a(47)
    If a(12) < a1(m1) Or a(12) > a1(m2) Then GoTo 120
    If b1(a(12)) = 0 Then GoTo 120
    If b(a(12)) = 0 Then b(a(12)) = a(12): c(12) = a(12) Else GoTo 120
    
    a(62) = Pr7 - a(12): If b(a(62)) = 0 Then b(a(62)) = a(62): c(62) = a(62) Else GoTo 620

    For j25 = m1 To m2                                           'a(25)
    If b(a1(j25)) = 0 Then b(a1(j25)) = a1(j25): c(25) = a1(j25) Else GoTo 250
    a(25) = a1(j25)

    a(75) = Pr7 - a(25): If b(a(75)) = 0 Then b(a(75)) = a(75): c(75) = a(75) Else GoTo 755

    For j17 = m1 To m2                                           'a(17)
    If b(a1(j17)) = 0 Then b(a1(j17)) = a1(j17): c(17) = a1(j17) Else GoTo 170
    a(17) = a1(j17)

    a(67) = Pr7 - a(17): If b(a(67)) = 0 Then b(a(67)) = a(67): c(67) = a(67) Else GoTo 670

    a(9) = s7 - a(17) - a(25) - a(33) - a(41) - a(1) - a(49)
    If a(9) < a1(m1) Or a(9) > a1(m2) Then GoTo 90
    If b1(a(9)) = 0 Then GoTo 90
    If b(a(9)) = 0 Then b(a(9)) = a(9): c(9) = a(9) Else GoTo 90

    a(59) = Pr7 - a(9): If b(a(59)) = 0 Then b(a(59)) = a(59): c(59) = a(59) Else GoTo 590
 
    For j37 = m1 To m2                                          'a(37)
    If b(a1(j37)) = 0 Then b(a1(j37)) = a1(j37): c(37) = a1(j37) Else GoTo 370
    a(37) = a1(j37)

    a(87) = Pr7 - a(37): If b(a(87)) = 0 Then b(a(87)) = a(87): c(87) = a(87) Else GoTo 870
  
    a(31) = s7 - a(7) - a(13) - a(19) - a(25) - a(37) - a(43)
    If a(31) < a1(m1) Or a(31) > a1(m2) Then GoTo 310
    If b1(a(31)) = 0 Then GoTo 310
    If b(a(31)) = 0 Then b(a(31)) = a(31): c(31) = a(31) Else GoTo 310

    a(81) = Pr7 - a(31): If b(a(81)) = 0 Then b(a(81)) = a(81): c(81) = a(81) Else GoTo 810

    For j39 = (m2 - 1) / 2 To m1 Step -1                                      'a(39)
    If b1(a1(j39)) = 0 Then GoTo 390
    If b(a1(j39)) = 0 Then b(a1(j39)) = a1(j39): c(39) = a1(j39) Else GoTo 390
    a(39) = a1(j39)

    a(89) = Pr7 - a(39): If b(a(89)) = 0 Then b(a(89)) = a(89): c(89) = a(89) Else GoTo 890

    For j32 = (m2 - 1) / 2 To m1 Step -1                                          'a(32)
    If b1(a1(j32)) = 0 Then GoTo 320
    If b(a1(j32)) = 0 Then b(a1(j32)) = a1(j32): c(32) = a1(j32) Else GoTo 320
    a(32) = a1(j32)

    a(82) = Pr7 - a(32): If b(a(82)) = 0 Then b(a(82)) = a(82): c(82) = a(82) Else GoTo 820

    For j18 = m1 To m2                                          'a(18)
    If b1(a1(j18)) = 0 Then GoTo 180
    If b(a1(j18)) = 0 Then b(a1(j18)) = a1(j18): c(18) = a1(j18) Else GoTo 180
    a(18) = a1(j18)

    a(68) = Pr7 - a(18): If b(a(68)) = 0 Then b(a(68)) = a(68): c(68) = a(68) Else GoTo 680

    a(11) = s7 - a(4) - a(18) - a(25) - a(32) - a(39) - a(46)
    If a(11) < a1(m1) Or a(11) > a1(m2) Then GoTo 110
    If b1(a(11)) = 0 Then GoTo 110
    If b(a(11)) = 0 Then b(a(11)) = a(11): c(11) = a(11) Else GoTo 110
    
    a(61) = Pr7 - a(11): If b(a(61)) = 0 Then b(a(61)) = a(61): c(61) = a(61) Else GoTo 610

    For j38 = m1 To m2                                          'a(38)
    If b1(a1(j38)) = 0 Then GoTo 380
    If b(a1(j38)) = 0 Then b(a1(j38)) = a1(j38): c(38) = a1(j38) Else GoTo 380
    a(38) = a1(j38)
   
    a(88) = Pr7 - a(38): If b(a(88)) = 0 Then b(a(88)) = a(88): c(88) = a(88) Else GoTo 880

    a(36) = s4 - a(37) - a(38) - a(39)
    If a(36) < a1(m1) Or a(36) > a1(m2) Then GoTo 360
    If b1(a(36)) = 0 Then GoTo 360
    If b(a(36)) = 0 Then b(a(36)) = a(36): c(36) = a(36) Else GoTo 360
    
    a(86) = Pr7 - a(36): If b(a(86)) = 0 Then b(a(86)) = a(86): c(86) = a(86) Else GoTo 860

    For j24 = m1 To m2                                          'a(24)
    If b1(a1(j24)) = 0 Then GoTo 240
    If b(a1(j24)) = 0 Then b(a1(j24)) = a1(j24): c(24) = a1(j24) Else GoTo 240
    a(24) = a1(j24)
 
    a(74) = Pr7 - a(24): If b(a(74)) = 0 Then b(a(74)) = a(74): c(74) = a(74) Else GoTo 740

    a(10) = s7 - a(3) - a(17) - a(24) - a(31) - a(38) - a(45)
    If a(10) < a1(m1) Or a(10) > a1(m2) Then GoTo 100
    If b1(a(10)) = 0 Then GoTo 100
    If b(a(10)) = 0 Then b(a(10)) = a(10): c(10) = a(10) Else GoTo 100
    
    a(60) = Pr7 - a(10): If b(a(60)) = 0 Then b(a(60)) = a(60): c(60) = a(60) Else GoTo 600

    For j30 = m1 To m2                                          'a(30)
    If b1(a1(j30)) = 0 Then GoTo 300
    If b(a1(j30)) = 0 Then b(a1(j30)) = a1(j30): c(30) = a1(j30) Else GoTo 300
    a(30) = a1(j30)

    a(80) = Pr7 - a(30): If b(a(80)) = 0 Then b(a(80)) = a(80): c(80) = a(80) Else GoTo 800

    a(29) = s4 - a(30) - a(31) - a(32)
    If a(29) < a1(m1) Or a(29) > a1(m2) Then GoTo 290
    If b1(a(29)) = 0 Then GoTo 290
    If b(a(29)) = 0 Then b(a(29)) = a(29): c(29) = a(29) Else GoTo 290
    
    a(79) = Pr7 - a(29): If b(a(79)) = 0 Then b(a(79)) = a(79): c(79) = a(79) Else GoTo 790

    For j23 = m1 To m2                                          'a(23)
    If b1(a1(j23)) = 0 Then GoTo 230
    If b(a1(j23)) = 0 Then b(a1(j23)) = a1(j23): c(23) = a1(j23) Else GoTo 230
    a(23) = a1(j23)

    a(73) = Pr7 - a(23): If b(a(73)) = 0 Then b(a(73)) = a(73): c(73) = a(73) Else GoTo 730

    a(22) = s4 - a(23) - a(24) - a(25)
    If a(22) < a1(m1) Or a(22) > a1(m2) Then GoTo 220
    If b1(a(22)) = 0 Then GoTo 220
    If b(a(22)) = 0 Then b(a(22)) = a(22): c(22) = a(22) Else GoTo 220
    
    a(72) = Pr7 - a(22): If b(a(72)) = 0 Then b(a(72)) = a(72): c(72) = a(72) Else GoTo 720

    a(16) = s7 - a(2) - a(9) - a(23) - a(30) - a(37) - a(44)
    If a(16) < a1(m1) Or a(16) > a1(m2) Then GoTo 160
    If b1(a(16)) = 0 Then GoTo 160
    If b(a(16)) = 0 Then b(a(16)) = a(16): c(16) = a(16) Else GoTo 160

    a(66) = Pr7 - a(16): If b(a(66)) = 0 Then b(a(66)) = a(66): c(66) = a(66) Else GoTo 660

    a(15) = s4 - a(16) - a(17) - a(18)
    If a(15) < a1(m1) Or a(15) > a1(m2) Then GoTo 150
    If b1(a(15)) = 0 Then GoTo 150
    If b(a(15)) = 0 Then b(a(15)) = a(15): c(15) = a(15) Else GoTo 150
    
    a(65) = Pr7 - a(15): If b(a(65)) = 0 Then b(a(65)) = a(65): c(65) = a(65) Else GoTo 650

    a(8) = s7 - a(9) - a(10) - a(11) - a(12) - a(13) - a(14)
    If a(8) < a1(m1) Or a(8) > a1(m2) Then GoTo 80
    If b1(a(8)) = 0 Then GoTo 80
    If b(a(8)) = 0 Then b(a(8)) = a(8): c(8) = a(8) Else GoTo 80
    
    a(58) = Pr7 - a(8): If b(a(58)) = 0 Then b(a(58)) = a(58): c(58) = a(58) Else GoTo 580


''          n9 = n9 + 1: GoSub 1740   'Print results (selected numbers)
            n9 = n9 + 1: GoSub 1750   'Print results (squares)
            Erase b, c:  GoTo 1000    'Print only first Top Square


5

    b(c(58)) = 0: c(58) = 0
580 b(c(8)) = 0: c(8) = 0
80  b(c(65)) = 0: c(65) = 0
650 b(c(15)) = 0: c(15) = 0
150 b(c(66)) = 0: c(66) = 0
660 b(c(16)) = 0: c(16) = 0
160
    b(c(72)) = 0: c(72) = 0
720 b(c(22)) = 0: c(22) = 0
220 b(c(73)) = 0: c(73) = 0
730 b(c(23)) = 0: c(23) = 0
230 Next j23

    b(c(79)) = 0: c(79) = 0
790 b(c(29)) = 0: c(29) = 0
290 b(c(80)) = 0: c(80) = 0
800 b(c(30)) = 0: c(30) = 0
300 Next j30

    b(c(60)) = 0: c(60) = 0
600 b(c(10)) = 0: c(10) = 0
100 b(c(74)) = 0: c(74) = 0
740 b(c(24)) = 0: c(24) = 0
240 Next j24

    b(c(86)) = 0: c(86) = 0
860 b(c(36)) = 0: c(36) = 0
360 b(c(88)) = 0: c(88) = 0
880 b(c(38)) = 0: c(38) = 0
380 Next j38

    b(c(61)) = 0: c(61) = 0
610 b(c(11)) = 0: c(11) = 0
110 b(c(68)) = 0: c(68) = 0
680 b(c(18)) = 0: c(18) = 0
180 Next j18

    b(c(82)) = 0: c(82) = 0
820 b(c(32)) = 0: c(32) = 0
320 Next j32

    b(c(89)) = 0: c(89) = 0
890 b(c(39)) = 0: c(39) = 0
390 Next j39

    b(c(81)) = 0: c(81) = 0
810 b(c(31)) = 0: c(31) = 0
310 b(c(87)) = 0: c(87) = 0
870 b(c(37)) = 0: c(37) = 0
370 Next j37
    
    b(c(59)) = 0: c(59) = 0
590 b(c(9)) = 0: c(9) = 0
90  b(c(67)) = 0: c(67) = 0
670 b(c(17)) = 0: c(17) = 0
170 Next j17
    b(c(75)) = 0: c(75) = 0
755 b(c(25)) = 0: c(25) = 0
250 Next j25

    b(c(62)) = 0: c(62) = 0
620 b(c(12)) = 0: c(12) = 0
120 b(c(63)) = 0: c(63) = 0
630 b(c(13)) = 0: c(13) = 0
130 b(c(69)) = 0: c(69) = 0
690 b(c(19)) = 0: c(19) = 0
190 b(c(70)) = 0: c(70) = 0
700 b(c(20)) = 0: c(20) = 0
193 Next j20

    b(c(64)) = 0: c(64) = 0
640 b(c(14)) = 0: c(14) = 0
140 b(c(71)) = 0: c(71) = 0
710 b(c(21)) = 0: c(21) = 0
210 Next j21

    b(c(76)) = 0: c(76) = 0
760 b(c(26)) = 0: c(26) = 0
260 b(c(77)) = 0: c(77) = 0
770 b(c(27)) = 0: c(27) = 0
263 Next j27

    b(c(78)) = 0: c(78) = 0
780 b(c(28)) = 0: c(28) = 0
280 Next j28
    
    b(c(83)) = 0: c(83) = 0
830 b(c(33)) = 0: c(33) = 0
330 b(c(84)) = 0: c(84) = 0
840 b(c(34)) = 0: c(34) = 0
340 Next j34

    b(c(85)) = 0: c(85) = 0
850 b(c(35)) = 0: c(35) = 0
350 Next j35

    b(c(90)) = 0: c(90) = 0
900 b(c(40)) = 0: c(40) = 0
400 b(c(91)) = 0: c(91) = 0
910 b(c(41)) = 0: c(41) = 0
410 Next j41

    b(c(92)) = 0: c(92) = 0
920 b(c(42)) = 0: c(42) = 0
420 Next j42

1000 Erase b1, b, c
     Next j100

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

End

'   Print results (selected numbers)

1740 For i1 = 1 To 49
        Cells(n9, i1).Value = a(i1)
     Next i1
     Cells(n9, 50).Select
     Cells(n9, 50).Value = s7
     Cells(n9, 51).Value = Rcrd1a      'Record
     Return

'   Print results, back square a()

1750 n2 = n2 + 1
     If n2 = 5 Then
          n2 = 1: k1 = k1 + 8: k2 = 1
     Else
          If n9 > 1 Then k2 = k2 + 8
     End If
     Cells(k1 + 1, k2 + 1).Select
     
     Cells(k1, k2 + 1).Select
     Cells(k1, k2 + 1).Font.Color = -4165632
     Cells(k1, k2 + 1).Value = s7
   
     i3 = 0
     For i1 = 1 To 7
         For i2 = 1 To 7
             i3 = i3 + 1
             Cells(k1 + i1, k2 + i2).Value = a(i3)
         Next i2
     Next i1
    
     Return

'   Fill Cube c7()

750
'   Top Square

    For i1 = 1 To 49
        c7(i1) = a7(i1)
    Next i1
    
'   Bottom Square
    
    c7(295) = Pr7 - c7(49): c7(296) = Pr7 - c7(44): c7(297) = Pr7 - c7(45): c7(298) = Pr7 - c7(46): c7(299) = Pr7 - c7(47):
    c7(300) = Pr7 - c7(48): c7(301) = Pr7 - c7(43):
    c7(302) = Pr7 - c7(14): c7(303) = Pr7 - c7(9):  c7(304) = Pr7 - c7(10): c7(305) = Pr7 - c7(11): c7(306) = Pr7 - c7(12):
    c7(307) = Pr7 - c7(13): c7(308) = Pr7 - c7(8):
    c7(309) = Pr7 - c7(21): c7(310) = Pr7 - c7(16): c7(311) = Pr7 - c7(17): c7(312) = Pr7 - c7(18): c7(313) = Pr7 - c7(19):
    c7(314) = Pr7 - c7(20): c7(315) = Pr7 - c7(15):
    c7(316) = Pr7 - c7(28): c7(317) = Pr7 - c7(23): c7(318) = Pr7 - c7(24): c7(319) = Pr7 - c7(25): c7(320) = Pr7 - c7(26):
    c7(321) = Pr7 - c7(27): c7(322) = Pr7 - c7(22):
    c7(323) = Pr7 - c7(35): c7(324) = Pr7 - c7(30): c7(325) = Pr7 - c7(31): c7(326) = Pr7 - c7(32): c7(327) = Pr7 - c7(33):
    c7(328) = Pr7 - c7(34): c7(329) = Pr7 - c7(29):
    c7(330) = Pr7 - c7(42): c7(331) = Pr7 - c7(37): c7(332) = Pr7 - c7(38): c7(333) = Pr7 - c7(39): c7(334) = Pr7 - c7(40):
    c7(335) = Pr7 - c7(41): c7(336) = Pr7 - c7(36):
    c7(337) = Pr7 - c7(7):  c7(338) = Pr7 - c7(2):  c7(339) = Pr7 - c7(3):  c7(340) = Pr7 - c7(4):  c7(341) = Pr7 - c7(5):
    c7(342) = Pr7 - c7(6):  c7(343) = Pr7 - c7(1):

    Return
    
'   Remove used primes and complements from available primes

950 For i1 = 1 To 49
        b1(a7(i1)) = 0
        b1(Pr7 - a7(i1)) = 0
    Next i1
    Return
    
'    Read Prime Numbers From sheet ShtNm1

2015 Pr7 = Sheets(ShtNm1).Cells(Rcrd1a, 1).Value    ' Pairsum
     nVar1 = Sheets(ShtNm1).Cells(Rcrd1a, 9).Value
     s4 = 2 * Pr7                                 ' MC4
     Cntr7 = Pr7 / 2                              ' Center
     s3 = 3 * Cntr7                               ' MC3
     s7 = 7 * Cntr7                               ' MC7
     
     Erase b1
     For j1 = 1 To nVar1
         x = Sheets(ShtNm1).Cells(Rcrd1a, 9 + j1).Value
         b1(x) = x
     Next j1
     pMax = Sheets(ShtNm1).Cells(Rcrd1a, 9 + nVar1).Value
    
'    Read Top Square 7 x 7
        
     For i1 = 1 To 49
         a7(i1) = Sheets(ShtNm2).Cells(j100, i1).Value
     Next i1
     GoSub 750      'Fill Top and Bottom c7()
     GoSub 950      'Remove used primes and complements from available primes

'    Restore available pairs in a1()

     n10 = 0
     For j1 = 1 To pMax
         If b1(j1) <> 0 Then
             n10 = n10 + 1
             a1(n10) = b1(j1)
         End If
     Next j1
     m1 = 1: m2 = n10: n10 = 0
     If a1(1) = 1 Then m1 = 2: m2 = m2 - 1

     Return

End Sub

Vorige Pagina Volgende Pagina About the Author