OFFSET
0,1
LINKS
Indranil Ghosh, Table of n, a(n) for n = 0..449
FORMULA
E.g.f.: (1 + exp(-x)) / (1 - x).
a(n) = A001120(n) unless n=0.
a(n) = A000166(n) + n!.
0 = a(n) * (a(n+1) + a(n+2) - a(n+3)) + a(n+1) * (a(n+1) + 2*a(n+2) - a(n+3)) + a(n+2) * (a(n+2)) if n>=0.
a(n) = Gamma(n+1) + Gamma(n+1, -1)*exp(-1). - Peter Luschny, Feb 28 2017
D-finite with recurrence a(n) +(-n+1)*a(n-1) +(-n+1)*a(n-2)=0. - R. J. Mathar, Sep 24 2021
EXAMPLE
G.f. = 2 + x + 3*x^2 + 8*x^3 + 33*x^4 + 164*x^5 + 985*x^6 + 6894*x^7 + ...
MAPLE
a := n -> GAMMA(n+1) + GAMMA(n+1, -1)*exp(-1):
seq(simplify(a(n)), n=0..22); # Peter Luschny, Feb 28 2017
MATHEMATICA
a[ n_] := If[ n < 0, 0, n! + Subfactorial[n]]
a[ n_] := If[ n < 1, 2 Boole[n == 0], n! + Round[ n! / E]]
a[ n_] := If[ n < 0, 0, n! + (-1)^n HypergeometricPFQ[ { -n, 1}, {}, 1]]
a[ n_] := If[ n<0, 0, n! SeriesCoefficient[ (1 + Exp[ -x]) / (1 - x), {x, 0, n}]]
PROG
(PARI) {a(n) = if( n<1, 2 * (n==0), n * a(n-1) + (-1)^n)}
(PARI) {a(n) = if( n<0, 0, n! * polcoeff( (1 + exp(-x + x * O(x^n))) / (1 - x), n))}
(Magma) m:=50; R<x>:=PowerSeriesRing(Rationals(), m); b:=Coefficients(R!((1+Exp(-x))/(1-x))); [Factorial(n-1)*b[n]: n in [1..m]]; // G. C. Greubel, Aug 07 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Michael Somos, Jan 25 2014
STATUS
approved