[Math] Available lists of all latin squares up to order 5

combinatoricslatin-square

There are available online lists of the number of all latin squares up to order 11, e.g.: https://oeis.org/A002860. For a permutation-based test of a latin square design, one option is to fit the model to all of the latin squares of the same order to derive the sampling distribution of the test statistic. Rather than generate all the latin squares for a given size each time a permutation test is performed, I could just read in the set of latin squares from disk.

Given the difficulty in determining how many latin squares there are of order $n$, I presume that there aren't simple algorithms for generating all latin squares of order $n$ either. I was wondering, given that some researchers have actually gone to the trouble of computing the number of latin squares up to order 11, if lists of these latin squares were publicly available in electronic form somewhere?

If not, are there reliable algorithms for generating all latin squares for order $n$, $n \in {3, 4, 5}$?

(I have a simple R implementation that will give these for $n = 3$ but I started to struggle at $n = 4$).

Best Answer

The best source is Brendan McKay's website: http://users.cecs.anu.edu.au/~bdm/data/latin.html which contains the data up to order $8$ (for non-isotopic squares) or order $7$ (for all reduced squares).

For orders $n \geq 10$, there's simply too many (even if we exclude inequivalent ones).

For order $9$, researchers (such as Ian Wanless and his academic relatives) have been known to perform lengthy computations that iterate through main class representatives, usually using supercomputers or clusters of computers. This is not an easy task.

Related Question