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.

A006347 a(n) = (n+1) a(n-1) + (-1)^n.

Original entry on oeis.org

0, 1, 3, 16, 95, 666, 5327, 47944, 479439, 5273830, 63285959, 822717468, 11518044551, 172770668266, 2764330692255, 46993621768336, 845885191830047, 16071818644770894, 321436372895417879, 6750163830803775460
Offset: 1

Views

Author

Keywords

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

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).

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