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

 

Logo
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<k<n-1, (offset 2). - Vladeta 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.
LINKS
C.-Y. Wang, P. Miska, I. Mező, The r-derangement numbers, Discrete Mathematics 340.7 (2017): 1681-1692.
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
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
Sequence in context: A319326 A214765 A006657 * A316702 A235351 A362245
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.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 08:14 EDT 2024. Contains 371769 sequences. (Running on oeis4.)