# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/
Search: id:a000387
Showing 1-1 of 1
%I A000387 M4138 N1716 #109 Jul 06 2023 06:57:01
%S A000387 0,0,1,0,6,20,135,924,7420,66744,667485,7342280,88107426,1145396460,
%T A000387 16035550531,240533257860,3848532125880,65425046139824,
%U A000387 1177650830516985,22375365779822544,447507315596451070,9397653627525472260,206748379805560389951
%N A000387 Rencontres numbers: number of permutations of [n] with exactly two fixed points.
%C A000387 Also: odd permutations of length n with no fixed points. - Martin Wohlgemuth (mail(AT)matroid.com), May 31 2003
%C A000387 Also number of cycles of length 2 in all derangements of [n]. Example: a(4)=6 because in the derangements of [4], namely (1432), (1342), (13)(24), (1423), (12)(34), (1243), (1234), (1324), and (14)(23), we have altogether 6 cycles of length 2. - _Emeric Deutsch_, Mar 31 2009
%D A000387 A. Kaufmann, Introduction à la combinatorique en vue des applications, Dunod, Paris, 1968 (see p. 92).
%D A000387 J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 65.
%D A000387 N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D A000387 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A000387 Chai Wah Wu, Table of n, a(n) for n = 0..200 (first 100 terms from T. D. Noe)
%H A000387 Bashir Ali and A. Umar, Some combinatorial properties of the alternating group, Southeast Asian Bulletin Math. 32 (2008), 823-830.
%H A000387 FindStat - Combinatorial Statistic Finder, The number of fixed points of a permutation
%H A000387 G. Gordon and E. McMahon, Moving faces to other places: facet derangements, Amer. Math. Monthly, 117 (2010), 865-88.
%H A000387 Piotr Miska, Arithmetic Properties of the Sequence of Derangements and its Generalizations, arXiv:1508.01987 [math.NT], 2015. (see Chapter 5 p. 44)
%H A000387 J. M. Thomas, The number of even and odd absolute permutations of n letters, Bull. Amer. Math. Soc. 31 (1925), 303-304.
%H A000387 M. Wohlgemuth, Derangements revisited
%H A000387 Index entries for sequences related to permutations with fixed points
%F A000387 a(n) = Sum_{j=2..n-2} (-1)^j*n!/(2!*j!) = A008290(n,2).
%F A000387 a(n) = (n!/2) * Sum_{i=0..n-2} ((-1)^i)/i!.
%F A000387 a(n) = A000166(n) - A003221(n).
%F A000387 a(n) = A000166(n-2)*binomial(n, 2). - _David Wasserman_, Aug 13 2004
%F A000387 E.g.f.: z^2*exp(-z)/(2*(1-z)). - _Emeric Deutsch_, Jul 22 2009
%F A000387 a(n) ~ n!*exp(-1)/2. - _Steven Finch_, Mar 11 2022
%F A000387 a(n) = n*a(n-1) + (-1^n)*n*(n-1)/2, a(0) = 0. - _Chai Wah Wu_, Sep 23 2014
%F A000387 a(n) = A003221(n) + (-1)^n*(n-1) (see Miska). - _Michel Marcus_, Aug 11 2015
%F A000387 O.g.f.: (1/2)*Sum_{k>=2} k!*x^k/(1 + x)^(k+1). - _Ilya Gutkovskiy_, Apr 13 2017
%F A000387 D-finite with recurrence +(-n+2)*a(n) +n*(n-3)*a(n-1) +n*(n-1)*a(n-2)=0. - _R. J. Mathar_, Jul 06 2023
%e A000387 a(4)=6 because we have 1243, 1432, 1324, 4231, 3214, and 2134. - _Emeric Deutsch_, Mar 31 2009
%p A000387 A000387:= n-> -add((n-1)!*add((-1)^k/(k-1)!, j=0..n-1), k=1..n-1)/2: seq(A000387(n), n=0..25); # _Zerinvary Lajos_, May 18 2007
%p A000387 A000387 := n -> (-1)^n*(hypergeom([-n,1],[],1)+n-1)/2:
%p A000387 seq(simplify(A000387(n)), n=0..22); # _Peter Luschny_, May 09 2017
%t A000387 Table[Subfactorial[n - 2]*Binomial[n, 2], {n, 0, 22}] (* _Zerinvary Lajos_, Jul 10 2009 *)
%o A000387 (Python)
%o A000387 A145221_list, m, x = [], 1, 0
%o A000387 for n in range(201):
%o A000387 x, m = x*n + m*(n*(n-1)//2), -m
%o A000387 A145221_list.append(x) # _Chai Wah Wu_, Sep 23 2014
%o A000387 (PARI) my(x='x+O('x^33)); concat([0,0], Vec( serlaplace(exp(-x)/(1-x)*(x^2/2!)) ) ) \\ _Joerg Arndt_, Feb 19 2014
%o A000387 (PARI) a(n) = ( n!*sum(r=2, n, (-1)^r/r!) - (-1)^(n-1)*(n-1))/2; \\ _Michel Marcus_, Apr 22 2016
%Y A000387 Column k=2 of A008290.
%Y A000387 Cf. A003221.
%Y A000387 A diagonal of A008291.
%Y A000387 Cf. A170942.
%K A000387 nonn,easy
%O A000387 0,5
%A A000387 _N. J. A. Sloane_
%E A000387 Prepended a(0)=a(1)=0, _Joerg Arndt_, Apr 22 2016
# Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE