Vorige Pagina About the Author

' Associated Pantriagonal Magic Cubes (m = 2x + 1, m >= 5, m Mod 3 ≠ 0)

' Tested with Office 2007 under Windows 7

Sub AssPntr21()

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

Sheets("Klad1").Select

m = 13

For i = 0 To m - 1
For j = 0 To m - 1
j1 = j1 + 1
For k = 0 To m - 1
k1 = k1 + 1: k2 = k2 + 1
    
    b = i + j + k + 1
    c = (m - 1) + i + j * (m - 1) - k
    d = (m - 1) + i * (m - 1) + j * (m - 1) + k
        
    b1 = b Mod m
    c1 = c Mod m
    d1 = d Mod m

    a = b1 * m ^ 2 + c1 * m + d1 + 1
    
'   Print Cube

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

'   Print Components
    
'   Cells(j1 + 1, k1 + 1 + (m + 1)).Value = b1
'   Cells(j1 + 1, k1 + 1 + 2 * (m + 1)).Value = c1
'   Cells(j1 + 1, k1 + 1 + 3 * (m + 1)).Value = d1

Next k
Next j
Next i

End Sub

Vorige Pagina About the Author