About the Author

' Generates Diamond Inlays of order 6 for Odd Numbers
' Suitable for Concentric Lozenge Squares of order 11

' Tested with Office 365 under Windows 10

```Sub Diamond6()

Dim a1(61), a(121), b1(121), b(121), c(121)

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

Sheets("Klad1").Select

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

Sheets("Klad1").Select

t1 = Timer

For i1 = 0 To 60                                         'Odd Numbers
a1(i1 + 1) = 2 * i1 + 1: b1(a1(i1 + 1)) = a1(i1 + 1)
Next i1
m1 = 1: m2 = 61: s1 = 671: p2 = 122

a(61) = 61: b(a(61)) = a(61)

For j116 = m2 To m1 Step -1
If b(a1(j116)) = 0 Then b(a1(j116)) = a1(j116): c(116) = a1(j116) Else GoTo 1160
a(116) = a1(j116)

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

For j106 = m1 To m2
If b(a1(j106)) = 0 Then b(a1(j106)) = a1(j106): c(106) = a1(j106) Else GoTo 1060
a(106) = a1(j106)

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

For j105 = m2 To m1 Step -1
If b(a1(j105)) = 0 Then b(a1(j105)) = a1(j105): c(105) = a1(j105) Else GoTo 1050
a(105) = a1(j105)

a(17) = p2 - a(105): If b(a(17)) = 0 Then b(a(17)) = a(17): c(17) = a(17) Else GoTo 170

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(16) = p2 - a(104): If b(a(16)) = 0 Then b(a(16)) = a(16): c(16) = a(16) Else GoTo 160

For j96 = m1 To m2
If b(a1(j96)) = 0 Then b(a1(j96)) = a1(j96): c(96) = a1(j96) Else GoTo 960
a(96) = a1(j96)

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

a(92) = 6 * s1 / 11 - a(96) - a(104) - a(106) - 2 * a(116)
If a(92) < a1(m1) Or a(92) > a1(m2) Then GoTo 920:
If b1(a(92)) = 0 Then GoTo 920
If b(a(92)) = 0 Then b(a(92)) = a(92): c(92) = a(92) Else GoTo 920

a(26) = p2 - a(92): If b(a(26)) = 0 Then b(a(26)) = a(26): c(26) = a(26) Else GoTo 260

For j95 = m1 To m2
If b(a1(j95)) = 0 Then b(a1(j95)) = a1(j95): c(95) = a1(j95) Else GoTo 950
a(95) = a1(j95)

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

For j94 = m2 To m1 Step -1
If b(a1(j94)) = 0 Then b(a1(j94)) = a1(j94): c(94) = a1(j94) Else GoTo 940
a(94) = a1(j94)

a(28) = p2 - a(94): If b(a(28)) = 0 Then b(a(28)) = a(28): c(28) = a(28) Else GoTo 280

a(72) = -3 * s1 / 11 + a(94) + a(104) + a(106) + a(116)
If a(72) < a1(m1) Or a(72) > a1(m2) Then GoTo 720:
If b1(a(72)) = 0 Then GoTo 720
If b(a(72)) = 0 Then b(a(72)) = a(72): c(72) = a(72) Else GoTo 720

a(50) = p2 - a(72): If b(a(50)) = 0 Then b(a(50)) = a(50): c(50) = a(50) Else GoTo 500

For j93 = m1 To m2
If b(a1(j93)) = 0 Then b(a1(j93)) = a1(j93): c(93) = a1(j93) Else GoTo 930
a(93) = a1(j93)

a(27) = p2 - a(93): If b(a(27)) = 0 Then b(a(27)) = a(27): c(27) = a(27) Else GoTo 270

For j97 = 2 To 120                                   'Corner Point 7 x 7 Border (Even)
a(97) = j97

a(25) = p2 - a(97)                                                              'Even

a(91) = s1 / 11 - a(93) - a(94) - a(95) - a(97) + a(104) + a(106) + 2 * a(116)  'Even
If a(91) < 2 Or a(91) > 120 Then GoTo 970
If a(91) = a(97) Or a(91) = a(25) Then GoTo 970

a(31) = p2 - a(91)                                                              'Even

For j86 = m2 To m1 Step -1
If b(a1(j86)) = 0 Then b(a1(j86)) = a1(j86): c(86) = a1(j86) Else GoTo 860
a(86) = a1(j86)

a(80) = p2 - a(86): If b(a(80)) = 0 Then b(a(80)) = a(80): c(80) = a(80) Else GoTo 800

For j85 = m1 To m2
If b(a1(j85)) = 0 Then b(a1(j85)) = a1(j85): c(85) = a1(j85) Else GoTo 850
a(85) = a1(j85)

a(37) = p2 - a(85): If b(a(37)) = 0 Then b(a(37)) = a(37): c(37) = a(37) Else GoTo 370

For j84 = m2 To m1 Step -1
If b(a1(j84)) = 0 Then b(a1(j84)) = a1(j84): c(84) = a1(j84) Else GoTo 840
a(84) = a1(j84)

a(40) = p2 - a(84): If b(a(40)) = 0 Then b(a(40)) = a(40): c(40) = a(40) Else GoTo 400

a(82) = 6 * s1 / 11 - a(84) - 2 * a(94) - a(104) - a(106)
If a(82) < a1(m1) Or a(82) > a1(m2) Then GoTo 820:
If b1(a(82)) = 0 Then GoTo 820
If b(a(82)) = 0 Then b(a(82)) = a(82): c(82) = a(82) Else GoTo 820

a(38) = p2 - a(82): If b(a(38)) = 0 Then b(a(38)) = a(38): c(38) = a(38) Else GoTo 380

For j83 = m1 To m2
If b(a1(j83)) = 0 Then b(a1(j83)) = a1(j83): c(83) = a1(j83) Else GoTo 830
a(83) = a1(j83)

a(39) = p2 - a(83): If b(a(39)) = 0 Then b(a(39)) = a(39): c(39) = a(39) Else GoTo 390

a(81) = -s1 / 11 - a(83) - a(85) + 2 * a(94) + a(104) + a(106)
If a(81) < a1(m1) Or a(81) > a1(m2) Then GoTo 810:
If b1(a(81)) = 0 Then GoTo 810
If b(a(81)) = 0 Then b(a(81)) = a(81): c(81) = a(81) Else GoTo 810

a(41) = p2 - a(81): If b(a(41)) = 0 Then b(a(41)) = a(41): c(41) = a(41) Else GoTo 410

For j76 = m2 To m1 Step -1
If b(a1(j76)) = 0 Then b(a1(j76)) = a1(j76): c(76) = a1(j76) Else GoTo 760
a(76) = a1(j76)

a(68) = p2 - a(76): If b(a(68)) = 0 Then b(a(68)) = a(68): c(68) = a(68) Else GoTo 680

a(66) = 6 * s1 / 11 - a(76) - a(86) - a(96) - a(106) - a(116)
If a(66) < a1(m1) Or a(66) > a1(m2) Then GoTo 660:
If b1(a(66)) = 0 Then GoTo 660
If b(a(66)) = 0 Then b(a(66)) = a(66): c(66) = a(66) Else GoTo 660

a(56) = p2 - a(66): If b(a(56)) = 0 Then b(a(56)) = a(56): c(56) = a(56) Else GoTo 560

For j75 = m1 To m2
If b(a1(j75)) = 0 Then b(a1(j75)) = a1(j75): c(75) = a1(j75) Else GoTo 750
a(75) = a1(j75)

a(69) = p2 - a(75): If b(a(69)) = 0 Then b(a(69)) = a(69): c(69) = a(69) Else GoTo 690

For j74 = m2 To m1 Step -1
If b(a1(j74)) = 0 Then b(a1(j74)) = a1(j74): c(74) = a1(j74) Else GoTo 740
a(74) = a1(j74)

a(70) = p2 - a(74): If b(a(70)) = 0 Then b(a(70)) = a(70): c(70) = a(70) Else GoTo 700

a(73) = -s1 / 11 + 0.5 * a(74) + 0.5 * a(84) + 0.5 * a(86) + 0.5 * a(96)
If a(73) < a1(m1) Or a(73) > a1(m2) Or CInt(a(73)) <> a(73) Then GoTo 730:
If b1(a(73)) = 0 Then GoTo 730
If b(a(73)) = 0 Then b(a(73)) = a(73): c(73) = a(73) Else GoTo 730

a(49) = p2 - a(73): If b(a(49)) = 0 Then b(a(49)) = a(49): c(49) = a(49) Else GoTo 490

a(71) = 7 * s1 / 11 - 0.5 * a(74) - 0.5 * a(84) - 0.5 * a(86) - a(94) - 0.5 * a(96) - a(104) - a(106) - a(116)
If a(71) < a1(m1) Or a(71) > a1(m2) Or CInt(a(71)) <> a(71) Then GoTo 710:
If b1(a(71)) = 0 Then GoTo 710
If b(a(71)) = 0 Then b(a(71)) = a(71): c(71) = a(71) Else GoTo 710

a(51) = p2 - a(71): If b(a(51)) = 0 Then b(a(51)) = a(51): c(51) = a(51) Else GoTo 510

a(62) = 9 * s1 / 11 - a(74) - a(84) - a(86) - a(94) - a(96) - a(104) - a(106) - a(116)
If a(62) < a1(m1) Or a(62) > a1(m2) Then GoTo 620:
If b1(a(62)) = 0 Then GoTo 620
If b(a(62)) = 0 Then b(a(62)) = a(62): c(62) = a(62) Else GoTo 620

a(60) = p2 - a(62):: If b(a(60)) = 0 Then b(a(60)) = a(60): c(60) = a(60) Else GoTo 600

For j65 = m1 To m2
If b(a1(j65)) = 0 Then b(a1(j65)) = a1(j65): c(65) = a1(j65) Else GoTo 650
a(65) = a1(j65)

a(57) = p2 - a(65): If b(a(57)) = 0 Then b(a(57)) = a(57): c(57) = a(57) Else GoTo 558

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

a(58) = p2 - a(64): If b(a(58)) = 0 Then b(a(58)) = a(58): c(58) = a(58) Else GoTo 580

a(63) = p2 + a(64) - a(74) + a(76) - a(83) - a(84) - 2 * a(85) + a(94) + a(106)
If a(63) < a1(m1) Or a(63) > a1(m2) Then GoTo 630:
If b1(a(63)) = 0 Then GoTo 630
If b(a(63)) = 0 Then b(a(63)) = a(63): c(63) = a(63) Else GoTo 630

a(59) = p2 - a(63): If b(a(59)) = 0 Then b(a(59)) = a(59): c(59) = a(59) Else GoTo 590

a(54) = 6 * s1 / 11 - a(64) - a(74) - a(84) - a(94) - a(104)
If a(54) < a1(m1) Or a(54) > a1(m2) Then GoTo 540:
If b1(a(54)) = 0 Then GoTo 540
If b(a(54)) = 0 Then b(a(54)) = a(54): c(54) = a(54) Else GoTo 540

a(46) = p2 - a(54): If b(a(46)) = 0 Then b(a(46)) = a(46): c(46) = a(46) Else GoTo 460

a(53) = 17*s1/11-2*a(64)-a(74)-a(75)-a(76)-a(84)-2*a(86)+a(91)-a(94)-2*a(96)-a(97)-a(104)-2*a(106)-2* a(116)
If a(53) < a1(m1) Or a(53) > a1(m2) Then GoTo 530:
If b1(a(53)) = 0 Then GoTo 530
If b(a(53)) = 0 Then b(a(53)) = a(53): c(53) = a(53) Else GoTo 530

a(47) = p2 - a(53): If b(a(47)) = 0 Then b(a(47)) = a(47): c(47) = a(47) Else GoTo 470

a(52) = -a(64) - a(76) + a(84) + a(94) + a(104)
If a(52) < a1(m1) Or a(52) > a1(m2) Then GoTo 520:
If b1(a(52)) = 0 Then GoTo 520
If b(a(52)) = 0 Then b(a(52)) = a(52): c(52) = a(52) Else GoTo 520

a(48) = p2 - a(52): If b(a(48)) = 0 Then b(a(48)) = a(48): c(48) = a(48) Else GoTo 480

a(42) = -12 * s1 / 11 + a(64) + a(74) + a(76) + a(84) + a(86) + a(94) + 2 * a(96) + a(104) + 2 * a(106) + 2 * a(116)
If a(42) < a1(m1) Or a(42) > a1(m2) Then GoTo 420:
If b1(a(42)) = 0 Then GoTo 420
If b(a(42)) = 0 Then b(a(42)) = a(42): c(42) = a(42) Else GoTo 420

a(36) = p2 - a(42): 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)

5

b(c(36)) = 0: c(36) = 0
360 b(c(42)) = 0: c(42) = 0
420 b(c(48)) = 0: c(48) = 0
480 b(c(52)) = 0: c(52) = 0
520 b(c(47)) = 0: c(47) = 0
470 b(c(53)) = 0: c(53) = 0
530 b(c(46)) = 0: c(46) = 0
460 b(c(54)) = 0: c(54) = 0
540 b(c(59)) = 0: c(59) = 0
590 b(c(63)) = 0: c(63) = 0
630 b(c(58)) = 0: c(58) = 0
580 b(c(64)) = 0: c(64) = 0
640 Next j64

b(c(57)) = 0: c(57) = 0
558 b(c(65)) = 0: c(65) = 0
650 Next j65

b(c(60)) = 0: c(60) = 0
600 b(c(62)) = 0: c(62) = 0
620 b(c(51)) = 0: c(51) = 0
510 b(c(71)) = 0: c(71) = 0
710 b(c(49)) = 0: c(49) = 0
490 b(c(73)) = 0: c(73) = 0
730 b(c(70)) = 0: c(70) = 0
700 b(c(74)) = 0: c(74) = 0
740 Next j74

b(c(69)) = 0: c(69) = 0
690 b(c(75)) = 0: c(75) = 0
750 Next j75

b(c(56)) = 0: c(56) = 0
560 b(c(66)) = 0: c(66) = 0
660 b(c(68)) = 0: c(68) = 0
680 b(c(76)) = 0: c(76) = 0
760 Next j76

b(c(41)) = 0: c(41) = 0
410 b(c(81)) = 0: c(81) = 0
810 b(c(39)) = 0: c(39) = 0
390 b(c(83)) = 0: c(83) = 0
830 Next j83

b(c(38)) = 0: c(38) = 0
380 b(c(82)) = 0: c(82) = 0
820 b(c(40)) = 0: c(40) = 0
400 b(c(84)) = 0: c(84) = 0
840 Next j84

b(c(37)) = 0: c(37) = 0
370 b(c(85)) = 0: c(85) = 0
850 Next j85

b(c(80)) = 0: c(80) = 0
800 b(c(86)) = 0: c(86) = 0
860 Next j86

970 Next j97

b(c(27)) = 0: c(27) = 0
270 b(c(93)) = 0: c(93) = 0
930 Next j93

b(c(50)) = 0: c(50) = 0
500 b(c(72)) = 0: c(72) = 0
720 b(c(28)) = 0: c(28) = 0
280 b(c(94)) = 0: c(94) = 0
940 Next j94

b(c(29)) = 0: c(29) = 0
290 b(c(95)) = 0: c(95) = 0
950 Next j95

b(c(26)) = 0: c(26) = 0
260 b(c(92)) = 0: c(92) = 0
920 b(c(30)) = 0: c(30) = 0
300 b(c(96)) = 0: c(96) = 0
960 Next j96

b(c(16)) = 0: c(16) = 0
160  b(c(104)) = 0: c(104) = 0
1040 Next j104

b(c(17)) = 0: c(17) = 0
170  b(c(105)) = 0: c(105) = 0
1050 Next j105

b(c(18)) = 0: c(18) = 0
180  b(c(106)) = 0: c(106) = 0
1060 Next j106

b(c(6)) = 0: c(6) = 0
60   b(c(116)) = 0: c(116) = 0
1160 Next j116

t2 = Timer

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

End

'    Double Check Identical Numbers a()

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

'   Print results (selected numbers)

2645 For i1 = 1 To 121
Cells(n9, i1).Value = a(i1)
Next i1
Cells(n9, 122).Value = n9
Return

'    Print results (squares)

2650 n2 = n2 + 1
If n2 = 4 Then
n2 = 1: k1 = k1 + 12: k2 = 1
Else
If n9 > 1 Then k2 = k2 + 12
End If

Cells(k1, k2 + 1).Select
Cells(k1, k2 + 1).Font.Color = -4165632
Cells(k1, k2 + 1).Value = n9

i3 = 0
For i1 = 1 To 11
For i2 = 1 To 11
i3 = i3 + 1
Cells(k1 + i1, k2 + i2).Value = a(i3)
Next i2
Next i1

Return

End Sub
```

 About the Author