Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #64 May 09 2020 04:45:29
%S 1,0,2,12,216,5280,190800,9344160,598066560,48443028480,4844306476800,
%T 586161043776000,84407190782745600,14264815236056985600,
%U 2795903786354347468800,629078351928420506112000,161044058093696572354560000,46541732789077953723039744000
%N a(n) = n! * d(n), where n! = factorial numbers (A000142), d(n) = subfactorial numbers (A000166).
%C 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 }.
%C 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
%C a(n) is approximately equal to (n!)^2/e. - _J. M. Bergot_, Jun 09 2018
%H Vincenzo Librandi, <a href="/A082491/b082491.txt">Table of n, a(n) for n = 0..200</a>
%H Ira Gessel, <a href="http://www.mat.univie.ac.at/~slc/opapers/s17gessel.html">Enumerative applications of symmetric functions</a>, Séminaire Lotharingien de Combinatoire, B17a (1987), 17 pp.
%H Shawn L. Witte, <a href="https://www.math.ucdavis.edu/~tdenena/dissertations/201910_Witte_Dissertation.pdf">Link Nomenclature, Random Grid Diagrams, and Markov Chain Methods in Knot Theory</a>, Ph. D. Dissertation, University of California-Davis (2020).
%F a(n) = n! * d(n) where d(n) = A000166(n).
%F a(n) = Sum_{k=0..n} binomial(n, k)^2 * (-1)^k * (n - k)!^2 * k!.
%F a(n+2) = (n+2)*(n+1) * ( a(n+1) + (n+1)*a(n) ).
%F a(n) ~ 2*Pi*n^(2*n+1)*exp(-2*n-1). - _Ilya Gutkovskiy_, Dec 04 2016
%p 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
%t Table[Subfactorial[n]*n!, {n, 0, 15}] (* _Zerinvary Lajos_, Jul 10 2009 *)
%o (Maxima) A000166[0]:1$
%o A000166[n]:=n*A000166[n-1]+(-1)^n$
%o makelist(n!*A000166[n], n, 0, 12); /* _Emanuele Munarini_, Mar 01 2011 */
%o (PARI)
%o d(n)=if(n<1, n==0, n*d(n-1)+(-1)^n);
%o a(n)=d(n)*n!;
%o vector(33,n,a(n-1))
%o /* _Joerg Arndt_, May 28 2012 */
%o (PARI) {a(n) = if( n<2, n==0, n! * round(n! / exp(1)))}; /* _Michael Somos_, Jun 24 2018 */
%o (Python)
%o A082491_list, m, x = [], 1, 1
%o for n in range(10*2):
%o ....x, m = x*n**2 + m, -(n+1)*m
%o ....A082491_list.append(x) # _Chai Wah Wu_, Nov 03 2014
%o (Scala)
%o val A082491_pairs: LazyList[BigInt && BigInt] =
%o (BigInt(0), BigInt(1)) #::
%o (BigInt(1), BigInt(0)) #::
%o lift2 {
%o case ((n, z), (_, y)) =>
%o (n+2, (n+2)*(n+1)*((n+1)*z+y))
%o } (A082491_pairs, A082491_pairs.tail)
%o val A082491: LazyList[BigInt] =
%o lift1(_._2)(A082491_pairs)
%o /** _Luc Duponcheel_, Jan 25 2020 */
%Y Cf. A000142, A000166.
%K easy,nonn
%O 0,3
%A _Emanuele Munarini_, Apr 28 2003