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.

A105927 Let d(n) = A000166(n); then a(n) = ( (n^2+n-1)*d(n) + (-1)^(n-1)*(n-1) )/2.

Original entry on oeis.org

0, 0, 2, 12, 84, 640, 5430, 50988, 526568, 5940576, 72755370, 961839340, 13656650172, 207316760352, 3351430059614, 57487448630220, 1042952206111440, 19954639072648768, 401578933206288978, 8480263630552747596, 187505565234912994340, 4332318322289242716480
Offset: 0

Views

Author

N. J. A. Sloane, Apr 27 2005

Keywords

Comments

Wang, Miska, & Mező call these 2-derangement numbers.
Number of permutations p of [n] such that p(k) = k+2 for exactly two k in the range 0Vladeta Jovovic, Dec 14 2007
Number of derangements of the multiset {0,0,1,2,...,n}. For example a(3)=12 because we have: {1,2,0,3,0}, {1,2,3,0,0}, {1,3,0,0,2}, {1,3,2,0,0}, {2,1,0,3,0}, {2,1,3,0,0}, {2,3,0,0,1}, {2,3,0,1,0}, {3,1,0,0,2}, {3,1,2,0,0}, {3,2,0,0,1}, {3,2,0,1,0}. - Geoffrey Critzer, Jun 02 2014
Number of derangements of a set of n + 2 elements such that the first two elements belong to distinct cycles. - Istvan Mezo, Apr 05 2017

References

  • P. A. MacMahon, Combinatory Analysis, 2 vols., Chelsea, NY, 1960, see p. 108.

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<3, n*(n-1),
           n*(n-1)*(a(n-1)+a(n-2))/(n-2))
        end:
    seq(a(n), n=0..25);  # Alois P. Heinz, Jun 03 2014
  • Mathematica
    Table[(Subfactorial[n+2]-2Subfactorial[n+1]-Subfactorial[n])/2,{n,0,21}] (* Geoffrey Critzer, Jun 02 2014 *)
  • PARI
    s(n) = if( n<1, 1, n * s(n-1) + (-1)^n);
    a(n) = (s(n + 2) - 2*s(n + 1) - s(n))/2; \\ Indranil Ghosh, Apr 06 2017

Formula

a(n) = n*(n-1)*(a(n-1) + a(n-2))/(n-2) for n >= 3, a(n) = n*(n-1) for n < 3. - Alois P. Heinz, Jun 03 2014
a(n) ~ sqrt(Pi/2) * n^(n+5/2) / exp(n+1). - Vaclav Kotesovec, Sep 05 2014
a(n) = (n^2 + n + 1) * n!/e + O(1). - Charles R Greathouse IV, Apr 07 2017