The OEIS is supported by the many generous donors to the OEIS Foundation.

 Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered thanks to the OEIS”). Other ways to Give
 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A105927 Let d(n) = A000166(n); then a(n) = ( (n^2+n-1)*d(n) + (-1)^(n-1)*(n-1) )/2. 2
 0, 0, 2, 12, 84, 640, 5430, 50988, 526568, 5940576, 72755370, 961839340, 13656650172, 207316760352, 3351430059614, 57487448630220, 1042952206111440, 19954639072648768, 401578933206288978, 8480263630552747596, 187505565234912994340, 4332318322289242716480 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,3 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 0= 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 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 *) PROG (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 CROSSREFS Cf. A000153, A018934, A055790. Sequence in context: A319326 A214765 A006657 * A316702 A235351 A052887 Adjacent sequences: A105924 A105925 A105926 * A105928 A105929 A105930 KEYWORD nonn AUTHOR N. J. A. Sloane, Apr 27 2005 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified December 8 08:22 EST 2022. Contains 358693 sequences. (Running on oeis4.)