A006347 a(n) = (n+1) a(n-1) + (-1)^n.
0, 1, 3, 16, 95, 666, 5327, 47944, 479439, 5273830, 63285959, 822717468, 11518044551, 172770668266, 2764330692255, 46993621768336, 845885191830047, 16071818644770894, 321436372895417879, 6750163830803775460
Offset: 1
Examples
a(2) = (1/2)*6 - 2 = 1, a(3) = (1/2)*24 - 9 = 3, a(4) = (1/2)*120 - 44 = 16 ... - _Gary Detlefs_, Apr 16 2010
References
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
Links
- Indranil Ghosh, Table of n, a(n) for n = 1..448
- J. A. Sharp & N. J. A. Sloane, Correspondence, 1977
Crossrefs
Cf. A000166.
Programs
-
Maple
a:=n->-n!*sum((-1)^k/k!, k=3..n): seq(a(n), n=2..21); # Zerinvary Lajos, May 25 2007 seq(1/2*(n+1)! -floor(((n+1)!+1)/e),n=1..30); # Gary Detlefs, Apr 16 2010
-
Mathematica
RecurrenceTable[{a[1] == 0, a[n] == (n + 1) a[n - 1] + (-1)^n}, a, {n, 20}] (* Harvey P. Dale, Oct 19 2012 *)
-
PARI
a(n)=if(n<2,0,(n+1)*a(n-1)+(-1)^n)
-
PARI
a(n)=round((1/2-exp(-1))*(n+1)!) \\ Benoit Cloitre, Sep 24 2006
Formula
E.g.f.: x(1 - x/2 - exp(-x))/(1-x)^2.
a(n) = round((1/2 - exp(-1))*(n+1)!). - Benoit Cloitre, Sep 24 2006
a(n) = n(a(n-1) + a(n-2)), n > 2. - Gary Detlefs, Apr 10 2010
a(n) = 1/2*(n+1)! - floor(((n+1)!+1)/e). - Gary Detlefs, Apr 16 2010
Comments