OFFSET
1,3
COMMENTS
a(n) is a function of the subfactorials .. a(n) = (n+1)!/2 - A000166(n+1) - Gary Detlefs, Apr 16 2010
a(n) can be seen indeed as a shifted-forward version of the subfactorials (or derangement numbers). - Olivier Gérard, Feb 23 2015
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
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
EXAMPLE
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
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved