Vorige Pagina About the Author

' Associated Nasik Magic Cubes (m = 2x + 1, m >= 9, gcd(m, 3 x 5 x 7) = 1)

' Tested with Office 2007 under Windows 7

Sub AssNasik21()

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

Sheets("Klad1").Select

m = 19

For k = 0 To m - 1
For i = 0 To m - 1
i1 = i1 + 1
For j = 0 To m - 1
j1 = j1 + 1: j2 = j2 + 1

    b = i + 2 * j + 4 * k + 3
    c = i - 2 * j + 4 * k + 1
    While c < 0
        c = c + m
    Wend
    d = i + 2 * j - 4 * k - 1
    While d < 0
        d = d + m
    Wend
    
    b1 = b Mod m
    c1 = c Mod m
    d1 = d Mod m
    
    a = b1 * m ^ 2 + c1 * m + d1 + 1

'   Print Cube

    If j1 = m + 1 Then j1 = 1
    If j2 = m ^ 2 + 1 Then j2 = 1: i1 = i1 + 1
    Cells(i1 + 1, j1 + 1).Value = a

'   print Components

''   Cells(i1 + 1, j1 + 1 + 9).Value = b1
''   Cells(i1 + 1, j1 + 1 + 18).Value = c1
''   Cells(i1 + 1, j1 + 1 + 27).Value = d1

Next j
Next i
Next k

End Sub

Vorige Pagina About the Author