Vorige Pagina About the Author

' Generates Associated Lozenge Squares of order 9 (L. S. Frierson)
' Associated Diamond Inlays order 4 and 5

' Tested with Office 2007 under Windows 7

Sub MgcSqr9b2()

    Dim a1(81), a(25), a9(81), b1(81), b(81), c(25), c9(81)
 
    y = MsgBox("Locked", vbCritical, "Routine MgcSqr9b2")
    End

    Sheets("Klad1").Select

    n5 = 0: n9 = 0: k1 = 1: k2 = 1

'   Define Parameters

    Pr3 = 82         'PairSum
    Cntr3 = 41       'Center Element
    s5 = 5 * Cntr3   'MC5
    s4 = 2 * Pr3     'MC4
    s3 = 3 * Cntr3   'MC3
    s9 = 9 * Cntr3   'MC9
    nvar = 81

    ShtNm2 = "Sqrs4"
    
    t1 = Timer

For j100 = 728 To 728 ''2 To 1001

'   Redefine integers

    Erase b1
    For j1 = 1 To nvar
            a1(j1) = j1: b1(j1) = j1
    Next j1
    m1 = 1: m2 = nvar
        
'   Read Diamond 4 x 4 (Associated Magic Square)
        
    For i1 = 1 To 16
         a(i1) = Sheets(ShtNm2).Cells(j100, i1).Value
         b(a(i1)) = a(i1)
    Next i1

    Erase a9
    
    i45 = 4: GoSub 1750                'Store in a9()

    Erase a

'   Generate Diamond 5 x 5 (Associated Magic Square)

a(13) = 0.2 * s5: b(a(13)) = a(13)

For j25 = m1 To m2 Step 2                                             '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(1) = 0.4 * s5 - a(25)
If a(1) < a1(m1) Or a(1) > a1(m2) Then GoTo 10
If b1(a(1)) = 0 Then GoTo 10
If b(a(1)) = 0 Then b(a(1)) = a(1): c(1) = a(1) Else GoTo 10

For j24 = m1 To m2 Step 2                                             'a(24)
If b(a1(j24)) = 0 Then b(a1(j24)) = a1(j24): c(24) = a1(j24) Else GoTo 240
a(24) = a1(j24)

a(2) = 0.4 * s5 - a(24)
If a(2) < a1(m1) Or a(2) > a1(m2) Then GoTo 20
If b1(a(2)) = 0 Then GoTo 20
If b(a(2)) = 0 Then b(a(2)) = a(2): c(2) = a(2) Else GoTo 20

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

a(3) = 0.4 * s5 - a(23)
If a(3) < a1(m1) Or a(3) > a1(m2) Then GoTo 30
If b1(a(3)) = 0 Then GoTo 30
If b(a(3)) = 0 Then b(a(3)) = a(3): c(3) = a(3) Else GoTo 30

For j22 = m1 To m2 Step 2                                             'a(22)
If b(a1(j22)) = 0 Then b(a1(j22)) = a1(j22): c(22) = a1(j22) Else GoTo 220
a(22) = a1(j22)

a(21) = s5 - a(22) - a(23) - a(24) - a(25)
If a(21) < a1(m1) Or a(21) > a1(m2) Then GoTo 210
If b1(a(21)) = 0 Then GoTo 210
If CInt(a(21) / 2) = a(21) / 2 Then GoTo 210
If b(a(21)) = 0 Then b(a(21)) = a(21): c(21) = a(21) Else GoTo 210

a(5) = 0.4 * s5 - a(21)
If a(5) < a1(m1) Or a(5) > a1(m2) Then GoTo 50
If b1(a(5)) = 0 Then GoTo 50
If b(a(5)) = 0 Then b(a(5)) = a(5): c(5) = a(5) Else GoTo 50

a(4) = 0.4 * s5 - a(22)
If a(4) < a1(m1) Or a(4) > a1(m2) Then GoTo 40
If b1(a(4)) = 0 Then GoTo 40
If b(a(4)) = 0 Then b(a(4)) = a(4): c(4) = a(4) Else GoTo 40

For j20 = m1 To m2 Step 2                                             'a(20)
If b(a1(j20)) = 0 Then b(a1(j20)) = a1(j20): c(20) = a1(j20) Else GoTo 200
a(20) = a1(j20)

a(6) = 2 * s5 / 5 - a(20)
If a(6) < a1(m1) Or a(6) > a1(m2) Then GoTo 60
If b1(a(6)) = 0 Then GoTo 60
If b(a(6)) = 0 Then b(a(6)) = a(6): c(6) = a(6) Else GoTo 60

For j19 = m1 To m2 Step 2                                             'a(19)
If b(a1(j19)) = 0 Then b(a1(j19)) = a1(j19): c(19) = a1(j19) Else GoTo 190
a(19) = a1(j19)

a(7) = 0.4 * s5 - a(19)
If a(7) < a1(m1) Or a(7) > a1(m2) Then GoTo 70
If b1(a(7)) = 0 Then GoTo 70
If b(a(7)) = 0 Then b(a(7)) = a(7): c(7) = a(7) Else GoTo 70

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

a(8) = 0.4 * s5 - a(18)
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

For j17 = m1 To m2 Step 2                                             '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(16) = s5 - a(17) - a(18) - a(19) - a(20)
If a(16) < a1(m1) Or a(16) > a1(m2) Then GoTo 160
If b1(a(16)) = 0 Then GoTo 160
If CInt(a(16) / 2) = a(16) / 2 Then GoTo 160
If b(a(16)) = 0 Then b(a(16)) = a(16): c(16) = a(16) Else GoTo 160

a(15) = s5 / 5 + a(16) - a(20) + a(21) - a(25)
If a(15) < a1(m1) Or a(15) > a1(m2) Then GoTo 150
If b1(a(15)) = 0 Then GoTo 150
If CInt(a(15) / 2) = a(15) / 2 Then GoTo 150
If b(a(15)) = 0 Then b(a(15)) = a(15): c(15) = a(15) Else GoTo 150

a(14) = s5 / 5 + a(17) - a(19) + a(22) - a(24)
If a(14) < a1(m1) Or a(14) > a1(m2) Then GoTo 140
If b1(a(14)) = 0 Then GoTo 140
If CInt(a(14) / 2) = a(14) / 2 Then GoTo 140
If b(a(14)) = 0 Then b(a(14)) = a(14): c(14) = a(14) Else GoTo 140

a(12) = 0.4 * s5 - a(14)
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(11) = 0.4 * s5 - a(15)
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(10) = 2 * s5 / 5 - a(16)
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(9) = 0.4 * s5 - a(17)
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

                i45 = 5: GoSub 1750                            'Store in a9()

                GoSub 800: If fl1 = 0 Then GoTo 5              'Check Frierson Properties 
               
                GoSub 2000                                     'Complete Border
                If fl1 = 0 Then GoTo 5                         'No Border Found

                GoSub 1800                                     'Double Check Identical Integers a9()
                If fl1 = 1 Then
                      n9 = n9 + 1: GoSub 1650                  'Print Composed Squares a9()
                End If
                
                Erase b, c: GoTo 1000                          'Print only first square
'               Erase b, c: a(13) = 41: b(41) = 41: GoTo 250   'Print only first square for j25

5
    b(c(9)) = 0: c(9) = 0
90  b(c(10)) = 0: c(10) = 0
100 b(c(11)) = 0: c(11) = 0
110 b(c(12)) = 0: c(12) = 0
120 b(c(14)) = 0: c(14) = 0
140 b(c(15)) = 0: c(15) = 0
150 b(c(16)) = 0: c(16) = 0
160 b(c(17)) = 0: c(17) = 0
170 Next j17

    b(c(8)) = 0: c(8) = 0
80  b(c(18)) = 0: c(18) = 0
180 Next j18

    b(c(7)) = 0: c(7) = 0
70  b(c(19)) = 0: c(19) = 0
190 Next j19

    b(c(6)) = 0: c(6) = 0
60  b(c(20)) = 0: c(20) = 0
200 Next j20
    
    b(c(4)) = 0: c(4) = 0
40  b(c(5)) = 0: c(5) = 0
50  b(c(21)) = 0: c(21) = 0
210 b(c(22)) = 0: c(22) = 0
220 Next j22

    b(c(3)) = 0: c(3) = 0
30  b(c(23)) = 0: c(23) = 0
230 Next j23

    b(c(2)) = 0: c(2) = 0
20  b(c(24)) = 0: c(24) = 0
240 Next j24

    b(c(1)) = 0: c(1) = 0
10  b(c(25)) = 0: c(25) = 0
250 Next j25

1000 Next j100

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

End

'   Check Frierson Properties Diamond (5 x 5)

800 fl1 = 1

'   Around Hor Axes

    y1 = a9(5) Mod 10:  y2 = a9(77) Mod 10: If y1 <> y2 Then fl1 = 0: Return
    y1 = a9(23) Mod 10: y2 = a9(59) Mod 10: If y1 <> y2 Then fl1 = 0: Return
    y1 = a9(13) Mod 10: y2 = a9(67) Mod 10: If y1 <> y2 Then fl1 = 0: Return
    y1 = a9(31) Mod 10: y2 = a9(49) Mod 10: If y1 <> y2 Then fl1 = 0: Return
    y1 = a9(21) Mod 10: y2 = a9(57) Mod 10: If y1 <> y2 Then fl1 = 0: Return
    y1 = a9(29) Mod 10: y2 = a9(47) Mod 10: If y1 <> y2 Then fl1 = 0: Return
    y1 = a9(15) Mod 10: y2 = a9(69) Mod 10: If y1 <> y2 Then fl1 = 0: Return
    y1 = a9(33) Mod 10: y2 = a9(51) Mod 10: If y1 <> y2 Then fl1 = 0: Return
    y1 = a9(25) Mod 10: y2 = a9(61) Mod 10: If y1 <> y2 Then fl1 = 0: Return
    y1 = a9(35) Mod 10: y2 = a9(53) Mod 10: If y1 <> y2 Then fl1 = 0: Return

'   Around Vert Axes

    y1 = a9(13) + a9(15): y2 = y1 Mod 10: If y2 <> 2 Then fl1 = 0: Return
    y1 = a9(21) + a9(25): y2 = y1 Mod 10: If y2 <> 2 Then fl1 = 0: Return
    y1 = a9(29) + a9(35): y2 = y1 Mod 10: If y2 <> 2 Then fl1 = 0: Return
    y1 = a9(31) + a9(33): y2 = y1 Mod 10: If y2 <> 2 Then fl1 = 0: Return
    y1 = a9(37) + a9(45): y2 = y1 Mod 10: If y2 <> 2 Then fl1 = 0: Return
    y1 = a9(39) + a9(43): y2 = y1 Mod 10: If y2 <> 2 Then fl1 = 0: Return
    y1 = a9(47) + a9(53): y2 = y1 Mod 10: If y2 <> 2 Then fl1 = 0: Return
    y1 = a9(49) + a9(51): y2 = y1 Mod 10: If y2 <> 2 Then fl1 = 0: Return
    y1 = a9(57) + a9(61): y2 = y1 Mod 10: If y2 <> 2 Then fl1 = 0: Return
    y1 = a9(67) + a9(69): y2 = y1 Mod 10: If y2 <> 2 Then fl1 = 0: Return

    Return

'     Print results (squares)

1650  n5 = n5 + 1
      If n5 = 5 Then
          n5 = 1: k1 = k1 + 10: k2 = 1
      Else
          If n9 > 1 Then k2 = k2 + 10
      End If
     
      Cells(k1, k2 + 1).Select
      Cells(k1, k2 + 1).Font.Color = -4165632
      Cells(k1, k2 + 1).Value = j100

      i3 = 0
      For i1 = 1 To 9
          For i2 = 1 To 9
              i3 = i3 + 1
              Cells(k1 + i1, k2 + i2).Value = a9(i3)
          Next i2
      Next i1
    
      Return
      
1750
     Select Case i45
     
     Case 4
                                            a9(14) = a(1):
                               a9(22) = a(5):      a9(24) = a(2):
                        a9(30) = a(9):     a9(32) = a(6):      a9(34) = a(3):
            a9(38) = a(13):     a9(40) = a(10):     a9(42) = a(7):      a9(44) = a(4):
                        a9(48) = a(14):    a9(50) = a(11):     a9(52) = a(8):
                                a9(58) = a(15):     a9(60) = a(12):
                                           a9(68) = a(16):
    
     Case 5
                                                  a9(5) = a(1):
                                       a9(13) = a(6):      a9(15) = a(2):
                              a9(21) = a(11):     a9(23) = a(7):      a9(25) = a(3):
                     a9(29) = a(16):     a9(31) = a(12):     a9(33) = a(8):      a9(35) = a(4):
            a9(37) = a(21):     a9(39) = a(17):     a9(41) = a(13):     a9(43) = a(9):      a9(45) = a(5):
                     a9(47) = a(22):     a9(49) = a(18):     a9(51) = a(14):     a9(53) = a(10):
                              a9(57) = a(23):     a9(59) = a(19):     a9(61) = a(15):
                                       a9(67) = a(24):     a9(69) = a(20):
                                                  a9(77) = a(25):
     
     End Select

     Return

'    Double Check Identical Numbers a9()

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

'    Complete Border

2000 fl1 = 1: Erase c9

'Complete Columns 4, 5, 6

For jj78 = m1 + 1 To m2 - 1 Step 2                                    'a9(78)
If b(a1(jj78)) = 0 Then b(a1(jj78)) = a1(jj78): c9(78) = a1(jj78) Else GoTo 2780
a9(78) = a1(jj78)

a9(4) = Pr3 - a9(78)
If a9(4) < a1(m1) Or a9(4) > a1(m2) Then GoTo 2040
If b1(a9(4)) = 0 Then GoTo 2040
If b(a9(4)) = 0 Then b(a9(4)) = a9(4): c9(4) = a9(4) Else GoTo 2040

a9(76) = s9 - a9(4) - a9(13) - a9(22) - a9(31) - a9(40) - a9(49) - a9(58) - a9(67)
If a9(76) < a1(m1) Or a9(76) > a1(m2) Then GoTo 2760
If b1(a9(76)) = 0 Then GoTo 2760
If CInt(a9(76) / 2) <> a9(76) / 2 Then GoTo 2760
If b(a9(76)) = 0 Then b(a9(76)) = a9(76): c9(76) = a9(76) Else GoTo 2760

a9(6) = Pr3 - a9(76)
If a9(6) < a1(m1) Or a9(6) > a1(m2) Then GoTo 2060
If b1(a9(6)) = 0 Then GoTo 2060
If b(a9(6)) = 0 Then b(a9(6)) = a9(6): c9(6) = a9(6) Else GoTo 2060

y1 = a9(4) Mod 10:    y2 = a9(76) Mod 10: If y1 <> y2 Then GoTo 2065
y1 = a9(6) Mod 10:    y2 = a9(78) Mod 10: If y1 <> y2 Then GoTo 2065
y1 = a9(4) + a9(6):   y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2065
y1 = a9(76) + a9(78): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2065

'Complete Rows 4, 5, 6

For jj36 = m1 + 1 To m2 - 1 Step 2                                    'a9(36)
If b(a1(jj36)) = 0 Then b(a1(jj36)) = a1(jj36): c9(36) = a1(jj36) Else GoTo 2360
a9(36) = a1(jj36)

a9(46) = Pr3 - a9(36)
If a9(46) < a1(m1) Or a9(46) > a1(m2) Then GoTo 2460
If b1(a9(46)) = 0 Then GoTo 2460
If b(a9(46)) = 0 Then b(a9(46)) = a9(46): c9(46) = a9(46) Else GoTo 2460

a9(54) = s9 - a9(46) - a9(47) - a9(48) - a9(49) - a9(50) - a9(51) - a9(52) - a9(53)
If a9(54) < a1(m1) Or a9(54) > a1(m2) Then GoTo 2540
If b1(a9(54)) = 0 Then GoTo 2540
If CInt(a9(54) / 2) <> a9(54) / 2 Then GoTo 2540
If b(a9(54)) = 0 Then b(a9(54)) = a9(54): c9(54) = a9(54) Else GoTo 2540

a9(28) = Pr3 - a9(54)
If a9(28) < a1(m1) Or a9(28) > a1(m2) Then GoTo 2280
If b1(a9(28)) = 0 Then GoTo 2280
If b(a9(28)) = 0 Then b(a9(28)) = a9(28): c9(28) = a9(28) Else GoTo 2280

y1 = a9(28) Mod 10:   y2 = a9(46) Mod 10: If y1 <> y2 Then GoTo 2285
y1 = a9(36) Mod 10:   y2 = a9(54) Mod 10: If y1 <> y2 Then GoTo 2285
y1 = a9(28) + a9(36): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2285
y1 = a9(46) + a9(54): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2285

'Complete Columns 3, 7

For jj79 = m1 + 1 To m2 - 1 Step 2                                    'a9(79)
If b(a1(jj79)) = 0 Then b(a1(jj79)) = a1(jj79): c9(79) = a1(jj79) Else GoTo 2790
a9(79) = a1(jj79)

a9(3) = Pr3 - a9(79)
If a9(3) < a1(m1) Or a9(3) > a1(m2) Then GoTo 2030
If b1(a9(3)) = 0 Then GoTo 2030
If b(a9(3)) = 0 Then b(a9(3)) = a9(3): c9(3) = a9(3) Else GoTo 2030

For jj70 = m1 + 1 To m2 - 1 Step 2                                    'a9(70)
If b(a1(jj70)) = 0 Then b(a1(jj70)) = a1(jj70): c9(70) = a1(jj70) Else GoTo 2700
a9(70) = a1(jj70)

a9(12) = Pr3 - a9(70)
If a9(12) < a1(m1) Or a9(12) > a1(m2) Then GoTo 2120
If b1(a9(12)) = 0 Then GoTo 2120
If b(a9(12)) = 0 Then b(a9(12)) = a9(12): c9(12) = a9(12) Else GoTo 2120

For jj16 = m1 + 1 To m2 - 1 Step 2                                    'a9(16)
If b(a1(jj16)) = 0 Then b(a1(jj16)) = a1(jj16): c9(16) = a1(jj16) Else GoTo 2160
a9(16) = a1(jj16)

a9(66) = Pr3 - a9(16)
If a9(66) < a1(m1) Or a9(66) > a1(m2) Then GoTo 2660
If b1(a9(66)) = 0 Then GoTo 2660
If b(a9(66)) = 0 Then b(a9(66)) = a9(66): c9(66) = a9(66) Else GoTo 2660

a9(7) = s9 - a9(16) - a9(25) - a9(34) - a9(43) - a9(52) - a9(61) - a9(70) - a9(79)
If a9(7) < a1(m1) Or a9(7) > a1(m2) Then GoTo 2070
If b1(a9(7)) = 0 Then GoTo 2070
If CInt(a9(7) / 2) <> a9(7) / 2 Then GoTo 2070
If b(a9(7)) = 0 Then b(a9(7)) = a9(7): c9(7) = a9(7) Else GoTo 2070

a9(75) = Pr3 - a9(7)
If a9(75) < a1(m1) Or a9(75) > a1(m2) Then GoTo 2750
If b1(a9(75)) = 0 Then GoTo 2750
If b(a9(75)) = 0 Then b(a9(75)) = a9(75): c9(75) = a9(75) Else GoTo 2750

y1 = a9(3) Mod 10:    y2 = a9(75) Mod 10: If y1 <> y2 Then GoTo 2755
y1 = a9(7) Mod 10:    y2 = a9(79) Mod 10: If y1 <> y2 Then GoTo 2755
y1 = a9(12) Mod 10:   y2 = a9(66) Mod 10: If y1 <> y2 Then GoTo 2755
y1 = a9(16) Mod 10:   y2 = a9(70) Mod 10: If y1 <> y2 Then GoTo 2755
y1 = a9(3) + a9(7):   y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2755
y1 = a9(12) + a9(16): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2755
y1 = a9(66) + a9(70): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2755
y1 = a9(75) + a9(79): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2755

'Complete Rows 3, 7

For jj27 = m1 + 1 To m2 - 1 Step 2                                    'a9(27)
If b(a1(jj27)) = 0 Then b(a1(jj27)) = a1(jj27): c9(27) = a1(jj27) Else GoTo 2270
a9(27) = a1(jj27)

a9(55) = Pr3 - a9(27)
If a9(55) < a1(m1) Or a9(55) > a1(m2) Then GoTo 2550
If b1(a9(55)) = 0 Then GoTo 2550
If b(a9(55)) = 0 Then b(a9(55)) = a9(55): c9(55) = a9(55) Else GoTo 2550

For jj26 = m1 + 1 To m2 - 1 Step 2                                    'a9(26)
If b(a1(jj26)) = 0 Then b(a1(jj26)) = a1(jj26): c9(26) = a1(jj26) Else GoTo 2260
a9(26) = a1(jj26)

a9(56) = Pr3 - a9(26)
If a9(56) < a1(m1) Or a9(56) > a1(m2) Then GoTo 2560
If b1(a9(56)) = 0 Then GoTo 2560
If b(a9(56)) = 0 Then b(a9(56)) = a9(56): c9(56) = a9(56) Else GoTo 2560

For jj20 = m1 + 1 To m2 - 1 Step 2                                    'a9(20)
If b(a1(jj20)) = 0 Then b(a1(jj20)) = a1(jj20): c9(20) = a1(jj20) Else GoTo 2200
a9(20) = a1(jj20)

a9(62) = Pr3 - a9(20)
If a9(62) < a1(m1) Or a9(62) > a1(m2) Then GoTo 2620
If b1(a9(62)) = 0 Then GoTo 2620
If b(a9(62)) = 0 Then b(a9(62)) = a9(62): c9(62) = a9(62) Else GoTo 2620

a9(19) = s9 - a9(20) - a9(21) - a9(22) - a9(23) - a9(24) - a9(25) - a9(26) - a9(27)
If a9(19) < a1(m1) Or a9(19) > a1(m2) Then GoTo 2190
If b1(a9(19)) = 0 Then GoTo 2190
If CInt(a9(19) / 2) <> a9(19) / 2 Then GoTo 2190
If b(a9(19)) = 0 Then b(a9(19)) = a9(19): c9(19) = a9(19) Else GoTo 2190

a9(63) = Pr3 - a9(19)
If a9(63) < a1(m1) Or a9(63) > a1(m2) Then GoTo 2630
If b1(a9(63)) = 0 Then GoTo 2630
If b(a9(63)) = 0 Then b(a9(63)) = a9(63): c9(63) = a9(63) Else GoTo 2630

y1 = a9(19) Mod 10:   y2 = a9(55) Mod 10: If y1 <> y2 Then GoTo 2635
y1 = a9(20) Mod 10:   y2 = a9(56) Mod 10: If y1 <> y2 Then GoTo 2635
y1 = a9(26) Mod 10:   y2 = a9(62) Mod 10: If y1 <> y2 Then GoTo 2635
y1 = a9(27) Mod 10:   y2 = a9(63) Mod 10: If y1 <> y2 Then GoTo 2635
y1 = a9(19) + a9(27): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2635
y1 = a9(20) + a9(26): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2635
y1 = a9(55) + a9(63): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2635
y1 = a9(56) + a9(62): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2635

For jj80 = m1 + 1 To m2 - 1 Step 2                                    'a9(80)
If b(a1(jj80)) = 0 Then b(a1(jj80)) = a1(jj80): c9(80) = a1(jj80) Else GoTo 2800
a9(80) = a1(jj80)

a9(2) = Pr3 - a9(80)
If a9(2) < a1(m1) Or a9(2) > a1(m2) Then GoTo 2020
If b1(a9(2)) = 0 Then GoTo 2020
If b(a9(2)) = 0 Then b(a9(2)) = a9(2): c9(2) = a9(2) Else GoTo 2020

For jj71 = m1 + 1 To m2 - 1 Step 2                                    'a9(71)
If b(a1(jj71)) = 0 Then b(a1(jj71)) = a1(jj71): c9(71) = a1(jj71) Else GoTo 2710
a9(71) = a1(jj71)

a9(11) = Pr3 - a9(71)
If a9(11) < a1(m1) Or a9(11) > a1(m2) Then GoTo 2110
If b1(a9(11)) = 0 Then GoTo 2110
If b(a9(11)) = 0 Then b(a9(11)) = a9(11): c9(11) = a9(11) Else GoTo 2110

For jj17 = m1 + 1 To m2 - 1 Step 2                                    'a9(17)
If b(a1(jj17)) = 0 Then b(a1(jj17)) = a1(jj17): c9(17) = a1(jj17) Else GoTo 2170
a9(17) = a1(jj17)

a9(65) = Pr3 - a9(17)
If a9(65) < a1(m1) Or a9(65) > a1(m2) Then GoTo 2650
If b1(a9(65)) = 0 Then GoTo 2650
If b(a9(65)) = 0 Then b(a9(65)) = a9(65): c9(65) = a9(65) Else GoTo 2650

a9(8) = s9 - a9(17) - a9(26) - a9(35) - a9(44) - a9(53) - a9(62) - a9(71) - a9(80)
If a9(8) < a1(m1) Or a9(8) > a1(m2) Then GoTo 2080
If b1(a9(8)) = 0 Then GoTo 2080
If CInt(a9(8) / 2) <> a9(8) / 2 Then GoTo 2080
If b(a9(8)) = 0 Then b(a9(8)) = a9(8): c9(8) = a9(8) Else GoTo 2080

a9(74) = Pr3 - a9(8)
If a9(74) < a1(m1) Or a9(74) > a1(m2) Then GoTo 2740
If b1(a9(74)) = 0 Then GoTo 2740
If b(a9(74)) = 0 Then b(a9(74)) = a9(74): c9(74) = a9(74) Else GoTo 2740

y1 = a9(2) Mod 10:    y2 = a9(74) Mod 10: If y1 <> y2 Then GoTo 2745
y1 = a9(8) Mod 10:    y2 = a9(80) Mod 10: If y1 <> y2 Then GoTo 2745
y1 = a9(11) Mod 10:   y2 = a9(65) Mod 10: If y1 <> y2 Then GoTo 2745
y1 = a9(17) Mod 10:   y2 = a9(71) Mod 10: If y1 <> y2 Then GoTo 2745
y1 = a9(2) + a9(8):   y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2745
y1 = a9(11) + a9(17): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2745
y1 = a9(65) + a9(71): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2745
y1 = a9(74) + a9(80): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2745

For jj81 = m1 + 1 To m2 - 1 Step 2                                    'a9(81)
If b(a1(jj81)) = 0 Then b(a1(jj81)) = a1(jj81): c9(81) = a1(jj81) Else GoTo 2810
a9(81) = a1(jj81)

a9(1) = Pr3 - a9(81)
If a9(1) < a1(m1) Or a9(1) > a1(m2) Then GoTo 2010
If b1(a9(1)) = 0 Then GoTo 2010
If b(a9(1)) = 0 Then b(a9(1)) = a9(1): c9(1) = a9(1) Else GoTo 2010

a9(73) = s9 - a9(74) - a9(75) - a9(76) - a9(77) - a9(78) - a9(79) - a9(80) - a9(81)
If a9(73) < a1(m1) Or a9(73) > a1(m2) Then GoTo 2730
If b1(a9(73)) = 0 Then GoTo 2730
If CInt(a9(73) / 2) <> a9(73) / 2 Then GoTo 2730
If b(a9(73)) = 0 Then b(a9(73)) = a9(73): c9(73) = a9(73) Else GoTo 2730

a9(9) = Pr3 - a9(73)
If a9(9) < a1(m1) Or a9(9) > a1(m2) Then GoTo 2090
If b1(a9(9)) = 0 Then GoTo 2090
If b(a9(9)) = 0 Then b(a9(9)) = a9(9): c9(9) = a9(9) Else GoTo 2090

a9(72) = (5*Pr3-a9(9)-a9(81)+a9(17)-a9(71)-a9(45)+a9(46)-a9(54)+a9(55)-a9(63)-a9(66)-a9(67)-a9(68)-a9(69)- a9(70))/2

If a9(72) < a1(m1) Or a9(72) > a1(m2) Then GoTo 2720
If b1(a9(72)) = 0 Then GoTo 2720
If CInt(a9(72) / 2) <> a9(72) / 2 Then GoTo 2720
If b(a9(72)) = 0 Then b(a9(72)) = a9(72): c9(72) = a9(72) Else GoTo 2720

a9(10) = Pr3 - a9(72)
If a9(10) < a1(m1) Or a9(10) > a1(m2) Then GoTo 2100
If b1(a9(10)) = 0 Then GoTo 2100
If b(a9(10)) = 0 Then b(a9(10)) = a9(10): c9(10) = a9(10) Else GoTo 2100

a9(18) = s9 - a9(9) - a9(27) - a9(36) - a9(45) - a9(54) - a9(63) - a9(72) - a9(81)
If a9(18) < a1(m1) Or a9(18) > a1(m2) Then GoTo 2180
If b1(a9(18)) = 0 Then GoTo 2180
If CInt(a9(18) / 2) <> a9(18) / 2 Then GoTo 2180
If b(a9(18)) = 0 Then b(a9(18)) = a9(18): c9(18) = a9(18) Else GoTo 2180

a9(64) = Pr3 - a9(18)
If a9(64) < a1(m1) Or a9(64) > a1(m2) Then GoTo 2640
If b1(a9(64)) = 0 Then GoTo 2640
If b(a9(64)) = 0 Then b(a9(64)) = a9(64): c9(64) = a9(64) Else GoTo 2640

y1 = a9(1) Mod 10:    y2 = a9(73) Mod 10: If y1 <> y2 Then GoTo 2645
y1 = a9(9) Mod 10:    y2 = a9(81) Mod 10: If y1 <> y2 Then GoTo 2645
y1 = a9(10) Mod 10:   y2 = a9(64) Mod 10: If y1 <> y2 Then GoTo 2645
y1 = a9(18) Mod 10:   y2 = a9(72) Mod 10: If y1 <> y2 Then GoTo 2645
y1 = a9(1) + a9(9):   y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2645
y1 = a9(10) + a9(18): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2645
y1 = a9(64) + a9(72): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2645
y1 = a9(73) + a9(81): y2 = y1 Mod 10:     If y2 <> 2 Then GoTo 2645

'               Option 1
                GoSub 3000: Return
                
'               Option 2

'               GoSub 1800                           'Double Check Identical Integers a9()
'               If fl1 = 1 Then
'                     n9 = n9 + 1: GoSub 1650        'Print Composed Squares a9()
'               End If

2645
     b(c9(64)) = 0: c9(64) = 0
2640 b(c9(18)) = 0: c9(18) = 0
2180 b(c9(10)) = 0: c9(10) = 0
2100 b(c9(72)) = 0: c9(72) = 0
2720
     b(c9(9)) = 0: c9(9) = 0
2090 b(c9(73)) = 0: c9(73) = 0
2730 b(c9(1)) = 0: c9(1) = 0
2010 b(c9(81)) = 0: c9(81) = 0
2810 Next jj81

2745
     b(c9(74)) = 0: c9(74) = 0
2740 b(c9(8)) = 0: c9(8) = 0
2080 b(c9(65)) = 0: c9(65) = 0
2650 b(c9(17)) = 0: c9(17) = 0
2170 Next jj17

     b(c9(11)) = 0: c9(11) = 0
2110 b(c9(71)) = 0: c9(71) = 0
2710 Next jj71

     b(c9(2)) = 0: c9(2) = 0
2020 b(c9(80)) = 0: c9(80) = 0
2800 Next jj80

2635
     b(c9(63)) = 0: c9(63) = 0
2630 b(c9(19)) = 0: c9(19) = 0
2190 b(c9(62)) = 0: c9(62) = 0
2620 b(c9(20)) = 0: c9(20) = 0
2200 Next jj20

     b(c9(56)) = 0: c9(56) = 0
2560 b(c9(26)) = 0: c9(26) = 0
2260 Next jj26

     b(c9(55)) = 0: c9(55) = 0
2550 b(c9(27)) = 0: c9(27) = 0
2270 Next jj27

2755
     b(c9(75)) = 0: c9(75) = 0
2750 b(c9(7)) = 0: c9(7) = 0
2070 b(c9(66)) = 0: c9(66) = 0
2660 b(c9(16)) = 0: c9(16) = 0
2160 Next jj16

     b(c9(12)) = 0: c9(12) = 0
2120 b(c9(70)) = 0: c9(70) = 0
2700 Next jj70

     b(c9(3)) = 0: c9(3) = 0
2030 b(c9(79)) = 0: c9(79) = 0
2790 Next jj79

2285
     b(c9(28)) = 0: c9(28) = 0
2280 b(c9(54)) = 0: c9(54) = 0
2540 b(c9(46)) = 0: c9(46) = 0
2460 b(c9(36)) = 0: c9(36) = 0
2360 Next jj36

2065
     b(c9(6)) = 0: c9(6) = 0
2060 b(c9(76)) = 0: c9(76) = 0
2760 b(c9(4)) = 0: c9(4) = 0
2040 b(c9(78)) = 0: c9(78) = 0
2780 Next jj78

     fl1 = 0
     Return

'    Reset Variables

3000
    b(c9(1)) = 0:  c9(1) = 0:  b(c9(81)) = 0: c9(81) = 0: b(c9(12)) = 0: c9(12) = 0: b(c9(70)) = 0: c9(70) = 0:
    b(c9(2)) = 0:  c9(2) = 0:  b(c9(80)) = 0: c9(80) = 0: b(c9(16)) = 0: c9(16) = 0: b(c9(66)) = 0: c9(66) = 0:
    b(c9(3)) = 0:  c9(3) = 0:  b(c9(79)) = 0: c9(79) = 0: b(c9(17)) = 0: c9(17) = 0: b(c9(65)) = 0: c9(65) = 0:
    b(c9(4)) = 0:  c9(4) = 0:  b(c9(78)) = 0: c9(78) = 0: b(c9(18)) = 0: c9(18) = 0: b(c9(64)) = 0: c9(64) = 0:
    b(c9(6)) = 0:  c9(6) = 0:  b(c9(76)) = 0: c9(76) = 0: b(c9(19)) = 0: c9(19) = 0: b(c9(63)) = 0: c9(63) = 0:
    b(c9(7)) = 0:  c9(7) = 0:  b(c9(75)) = 0: c9(75) = 0: b(c9(20)) = 0: c9(20) = 0: b(c9(62)) = 0: c9(62) = 0:
    b(c9(8)) = 0:  c9(8) = 0:  b(c9(74)) = 0: c9(74) = 0: b(c9(26)) = 0: c9(26) = 0: b(c9(56)) = 0: c9(56) = 0:
    b(c9(9)) = 0:  c9(9) = 0:  b(c9(73)) = 0: c9(73) = 0: b(c9(27)) = 0: c9(27) = 0: b(c9(55)) = 0: c9(55) = 0:
    b(c9(10)) = 0: c9(10) = 0: b(c9(72)) = 0: c9(72) = 0: b(c9(28)) = 0: c9(28) = 0: b(c9(54)) = 0: c9(54) = 0:
    b(c9(11)) = 0: c9(11) = 0: b(c9(71)) = 0: c9(71) = 0: b(c9(36)) = 0: c9(36) = 0: b(c9(46)) = 0: c9(46) = 0:

    Return

End Sub

Vorige Pagina About the Author