login
A173104
The number of possible borders of Latin squares.
2
1, 2, 12, 624, 110880, 58769280, 67704940800, 149428671436800, 574091539551129600, 3581833707481042944000, 34393612685291413069824000, 486990328595374993951457280000, 9818890674272030616178239406080000, 273823820339488809857168046768783360000
OFFSET
1,2
COMMENTS
The definition is not quite right, and should be corrected.
LINKS
J. de Ruiter, On Jigsaw Sudoku Puzzles and Related Topics, Bachelor Thesis, Leiden Institute of Advanced Computer Science, 2010.
FORMULA
For n>3, a(n)=n!(n-2)!((n-1)/(n-2)d[n-1]^2+2d[n-1]d[n-2]+(2n-5)/(n-3)d[n-2]^2), where d[k] is the number of derangements of k elements (A000166).
EXAMPLE
Two arbitrary configurations for n=3:
123 312
2 1 1 3
312 231
Two arbitrary configurations for n=4:
1234 1432
2 1 3 4
3 2 4 1
4123 2143
MAPLE
d:= proc(n) d(n):= `if`(n<=1, 1-n, (n-1)*(d(n-1)+d(n-2))) end:
b:= proc(n) b(n):= `if`(n<4, [1, 1, 2][n], (n-2)!*((n-1)/
(n-2)*d(n-1)^2+2*d(n-1)*d(n-2)+(2*n-5)/(n-3)*d(n-2)^2))
end:
a:= n-> n!*b(n):
seq(a(n), n=1..20); # Alois P. Heinz, Aug 18 2013
MATHEMATICA
d = Subfactorial;
a[n_] := If[n <= 3, {1, 2, 12}[[n]], n! (n-2)! ((n-1)/(n-2) d[n-1]^2 + 2d[n-1] d[n-2] + (2n-5)/(n-3) d[n-2]^2)];
Array[a, 20] (* Jean-François Alcover, Nov 10 2020 *)
CROSSREFS
Related to A000166. Equals A173103 multiplied by n!.
Sequence in context: A108078 A052129 A216335 * A141770 A363098 A230265
KEYWORD
nonn
AUTHOR
Johan de Ruiter, Feb 09 2010
STATUS
approved