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.

A003221 Number of even permutations of length n with no fixed points.

Original entry on oeis.org

1, 0, 0, 2, 3, 24, 130, 930, 7413, 66752, 667476, 7342290, 88107415, 1145396472, 16035550518, 240533257874, 3848532125865, 65425046139840, 1177650830516968, 22375365779822562, 447507315596451051, 9397653627525472280, 206748379805560389930
Offset: 0

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Maple
    A003221 := n -> ((-1)^n*hypergeom([-n,1],[],1)-(-1)^n*(n-1))/2:
    seq(simplify(A003221(n)), n=0..22); # Peter Luschny, May 09 2017
  • Mathematica
    a[n_] := (Round[n!/E] - (-1)^n*(n - 1))/2; a[0] = 1; Table[a[n], {n, 0, 22}] (* Jean-François Alcover, Dec 13 2011, after Simon Plouffe *)
    Range[0, 25]! CoefficientList[Series[(1 - x^2 / 2) E^(-x) / (1 - x), {x, 0, 25}], x] (* Vincenzo Librandi, Aug 11 2015 *)
  • PARI
    a(n) = ( n!*sum(r=2, n, (-1)^r/r!) + (-1)^(n-1)*(n-1))/2; \\ Michel Marcus, Apr 22 2016
  • Python
    A003221_list, m, x = [], -1, 0
    for n in range(10*2):
        x, m = x*n + m*(n*(n-1)//2-1), -m
        A003221_list.append(x) # Chai Wah Wu, Nov 03 2014
    

Formula

a(n) = (A000166(n)-(-1)^n*(n-1))/2.
From Abdullahi Umar, Oct 09 2008: (Start)
a(n) = (n!/2)*sum(((-1)^i)/i!, i=0..n-2)+((-1)^(n-1))*(n-1) for n>1, a(0)=1, a(1)=0.
a(n) = (n-1)*(a(n-1)+a(n-2))+((-1)^(n-1))*(n-1) for n>1, a(0)=1, a(1)=0.
a(n) = n*a(n-1)+((-1)^(n-1))*(n-2)*(n+1)/2 for n>0, a(0)=1.
E.g.f.: (1-x^2/2)*exp(-x)/(1-x). (End)

Extensions

Typo in second formula fixed by Josh Swanson, Nov 10 2013