OFFSET
0,3
COMMENTS
a(n) is also the number of pairs of n-permutations p and q such that p(x)<>q(x) for each x in { 1, 2, ..., n }.
Or number of n X n matrices with exactly one 1 and one 2 in each row and column, other entries 0 (cf. A001499). - Vladimir Shevelev, Mar 22 2010
a(n) is approximately equal to (n!)^2/e. - J. M. Bergot, Jun 09 2018
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..200
Ira Gessel, Enumerative applications of symmetric functions, Séminaire Lotharingien de Combinatoire, B17a (1987), 17 pp.
Shawn L. Witte, Link Nomenclature, Random Grid Diagrams, and Markov Chain Methods in Knot Theory, Ph. D. Dissertation, University of California-Davis (2020).
FORMULA
a(n) = n! * d(n) where d(n) = A000166(n).
a(n) = Sum_{k=0..n} binomial(n, k)^2 * (-1)^k * (n - k)!^2 * k!.
a(n+2) = (n+2)*(n+1) * ( a(n+1) + (n+1)*a(n) ).
a(n) ~ 2*Pi*n^(2*n+1)*exp(-2*n-1). - Ilya Gutkovskiy, Dec 04 2016
MAPLE
with (combstruct):a:=proc(m) [ZL, {ZL=Set(Cycle(Z, card>=m))}, labeled]; end: ZLL:=a(2):seq(count(ZLL, size=n)*n!, n=0..15); # Zerinvary Lajos, Jun 11 2008
MATHEMATICA
Table[Subfactorial[n]*n!, {n, 0, 15}] (* Zerinvary Lajos, Jul 10 2009 *)
PROG
(Maxima) A000166[0]:1$
makelist(n!*A000166[n], n, 0, 12); /* Emanuele Munarini, Mar 01 2011 */
(PARI)
d(n)=if(n<1, n==0, n*d(n-1)+(-1)^n);
a(n)=d(n)*n!;
vector(33, n, a(n-1))
/* Joerg Arndt, May 28 2012 */
(PARI) {a(n) = if( n<2, n==0, n! * round(n! / exp(1)))}; /* Michael Somos, Jun 24 2018 */
(Python)
A082491_list, m, x = [], 1, 1
for n in range(10*2):
....x, m = x*n**2 + m, -(n+1)*m
....A082491_list.append(x) # Chai Wah Wu, Nov 03 2014
(Scala)
val A082491_pairs: LazyList[BigInt && BigInt] =
(BigInt(0), BigInt(1)) #::
(BigInt(1), BigInt(0)) #::
lift2 {
case ((n, z), (_, y)) =>
(n+2, (n+2)*(n+1)*((n+1)*z+y))
val A082491: LazyList[BigInt] =
lift1(_._2)(A082491_pairs)
/** Luc Duponcheel, Jan 25 2020 */
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Emanuele Munarini, Apr 28 2003
STATUS
approved