Quotient, Remainder

The pair of orthogonal diagonal Latin squares, (ODLS), that make a (Graeco-Latin) magic square, are here called Q, (quotient), and R, (remainder). The magic square is made as:

                 M[r][c] = n x Q[r][c] + R[r][c] + 1,
 0 ≤ r,c < n

which for a SODLS is equivalent to:

                 M[r][c] = n x Q[r][c] + Q[c][r] + 1

How Many

The number of SODLS is 4 times the number of unique magic squares because 4 SODLS (aspects) make 4 aspects of the same magic square.

The nfr, (natural order first row), numbers were obtained by a backtracking program.

With the exception of order 9, all (nfr x n!) SODLS and magic squares were written to disk for analysis. For order 9, only nfr SODLS and associative and pandiagonal magic squares were written to disk, the others being counted, type checked, and discarded.

For orders 4, 5, and 7, all the numbers were determined by backtracking and confirmed by permutation of the nfr.

The orders 8 and 9 numbers were obtained by permutation of the nfr, and the associative numbers were checked by backtracking. Francis Gaspalou's order 8 number 1,152 is confirmed.


For SODLS the orientation, (aspect), has to be considered.

The four aspects of a SODLS that keep the diagonals in the same position, make four aspects of a magic square.

Doubly Self-Orthogonal

For some orders, the other four aspects, in which the positions of the forward and back diagonals are reversed, make four aspects of a different magic square.
Miguel Angel Amela refers to such a SODLS as a:

Doubly Self-Orthogonal Diagonal Latin Square (orthogonal to its transpose and its antitranspose)

The term "doubly self-orthogonal Latin square" was coined by Kim and Kumar.
Miguel has extended this to quadruply and sextuply self-orthogonal Latin squares. See 6-SOLS 9x9.pdf.

Here is an order 4 doubly SODLS example. The blue square aspects are made from the Q aspect and its transpose, (rotation about the blue diagonal):

M[r][c] = n x Q[r][c] + Q[c][r] + 1

The red square aspects are made from the Q aspect and its antitranspose, (rotation about the red diagonal):

M[r][c] = n x Q[r][c] + Q[n-1-c][n-1-r] + 1

All SODLS of order 4, 5, 7, and 8 are doubly self-orthogonal.

Singly Self-Orthogonal

For some other orders a SODLS may not be orthogonal to its antitranspose, (when superposed with the antitranspose, some symbol overlays are duplicated, and some are missing).

For order 9, some SODLS are doubly self-orthogonal and some are not. Of the 224,832 nfr, natural order first row, 28,608 are doubly SODLS and 196,224 are singly SODLS. These numbers are confirmed by Francis Gaspalou, (June, 2016).

There is no doubly SODLS of order 10. See Lu, Liu and Zhang


Program MagicSquaresSODLS uses Planck's "A-D method" to convert associative SODLS to pandiagonal SODLS. This works for the associative SODLS made by the program. However, it does not work for all associative SODLS.

For order 8, converting all 294,912 aspects of the 36,864 unique associative SODLS makes 172,032 pandiagonal SODLS, (21,504 unique). The rest, even though they do make pandiagonal complete magic squares, are not diagonal Latin squares. There are duplicated symbols on the forward diagonal. Example: