cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A055596 Expansion of e.g.f. (2 - x - 2*exp(-x))/(1-x).

This page as a plain text file.
%I A055596 #54 Jul 02 2025 16:01:59
%S A055596 1,0,2,6,32,190,1332,10654,95888,958878,10547660,126571918,1645434936,
%T A055596 23036089102,345541336532,5528661384510,93987243536672,
%U A055596 1691770383660094,32143637289541788,642872745790835758,13500327661607550920,297007208555366120238
%N A055596 Expansion of e.g.f. (2 - x - 2*exp(-x))/(1-x).
%C A055596 It appears that a(n) = n*a(n-1) + 2(-1)^(n+1) and that the n-th term of any sequence of the form {A(0) =a, A(1)= b, A(n) = (n-1)(A(n-1)+A(n-2))} is A(n) = b*A000166(n) + a*A055596(n). A(n) can also be expressed as A(n) = n*A(n-1) + (2a-b)(-1)^(n+1). - _Gary Detlefs_, Jun 13 2009
%C A055596 For n>1, sum over all permutations beginning with an ascent, ending with a descent, and without double ascents on n elements and each contributes 2 to the power of the number of double descents. By symmetry, also the sum over all permutations with a descent, ending with an ascent, and no double ascents and the sum is (again) over 2 to the power of the number of double descents. - _Richard Ehrenborg_, Oct 08 2013
%C A055596 It also appears related to a Secret Santa problem: given n people getting names from an urn to give presents and putting them back in the urn if they get their own name, this seems to be the number of ways that it may fail for the last person, as he/she has no other name to get from the urn. - _João Batista Souza de Oliveira_, Jan 25 2016
%H A055596 Alois P. Heinz, <a href="/A055596/b055596.txt">Table of n, a(n) for n = 1..200</a>
%H A055596 R. Ehrenborg and J. Jung, <a href="http://dx.doi.org/10.1016/j.aam.2012.08.004">Descent pattern avoidance</a>, Adv. in Appl. Math., 49 (2012) 375-390.
%H A055596 Lapo Cioni and Luca Ferrari, <a href="https://arxiv.org/abs/2102.07628">Preimages under the Queuesort algorithm</a>, arXiv preprint arXiv:2102.07628 [math.CO], 2021; Discrete Math., 344 (2021), #112561.
%F A055596 E.g.f.: (2-x-2*exp(-x))/(1-x).
%F A055596 a(n) = (n-1)*(a(n-1) + a(n-2)) = 2*A006347(n-1), n>2.
%F A055596 a(n) = n! - 2*A000166(n), n>0.
%F A055596 a(n) ~ n! * (1-2*exp(-1)). - _Vaclav Kotesovec_, Oct 07 2013
%F A055596 For n>2, a(n) = floor(n! * (1-2*exp(-1)) + 1/2). - _Peter Bala_, Oct 08 2013
%F A055596 a(n+1) = 2*A002467(n) - n!. - _Vaclav Kotesovec_, Oct 08 2013
%e A055596 a(4)=6 since the 3 permutations 1432, 2431, 3421 all have one double descent and hence each contributes 2 to the sum. - _Richard Ehrenborg_, Oct 08 2013
%e A055596 For the Secret Santa, a(3)=2 since person 1 will get the names of either person 2 or 3. Suppose it was person 2. Person 2 will then get either person 1 or person 3. If he/she gets person 1, the draw will fail for person 3. The other case occurs when person 1 draws person 3, person 3 draws person 1 and the draw fails for person 2. - _João Batista Souza de Oliveira_, Jan 25 2016
%t A055596 Rest[CoefficientList[Series[(2-x-2*E^(-x))/(1-x), {x, 0, 20}], x]* Range[0, 20]!] (* _Vaclav Kotesovec_, Oct 07 2013 *)
%o A055596 (PARI) a(n)=if(n<2, n>0, n*a(n-1)-2*(-1)^n)
%o A055596 (PARI) a(n)=if(n<1,0,n!*polcoeff((2-x-2*exp(-x+x*O(x^n)))/(1-x),n))
%o A055596 (Magma)
%o A055596 A055596:= func< n | Factorial(n)*(1 -2*(&+[(-1)^j/Factorial(j): j in [0..n]]) ) >;
%o A055596 [A055596(n): n in [1..30]]; // _G. C. Greubel_, Sep 06 2022
%o A055596 (SageMath)
%o A055596 def A055596(n): return factorial(n)*( 2*bool(n==0) + 1 - 2*sum((-1)^j/factorial(j) for j in (0..n)) )
%o A055596 [A055596(n) for n in (1..30)] # _G. C. Greubel_, Sep 06 2022
%Y A055596 Cf. A000166, A002467, A230071, A227918.
%K A055596 nonn
%O A055596 1,3
%A A055596 _Gary Detlefs_, Jul 10 2000
%E A055596 More terms from _James Sellers_, Jul 11 2000