Skip to contents

The cyclic construction \(L[i][j] = (i + j) \bmod n\) works for every \(n\), so Latin squares exist unconditionally.

Usage

morie_latin_square(n, method = c("cyclic", "shifted"))

Arguments

n

Order.

method

"cyclic" or "shifted".

Value

A list with square, order, valid.

Examples

morie_latin_square(n = 5L)
#> $square
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    0    1    2    3    4
#> [2,]    1    2    3    4    0
#> [3,]    2    3    4    0    1
#> [4,]    3    4    0    1    2
#> [5,]    4    0    1    2    3
#> 
#> $order
#> [1] 5
#> 
#> $valid
#> [1] TRUE
#> 
#> $method
#> [1] "cyclic"
#>