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

%I #33 May 06 2017 12:33:03

%S 0,0,2,12,84,640,5430,50988,526568,5940576,72755370,961839340,

%T 13656650172,207316760352,3351430059614,57487448630220,

%U 1042952206111440,19954639072648768,401578933206288978,8480263630552747596,187505565234912994340,4332318322289242716480

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

%C Wang, Miska, & Mező call these 2-derangement numbers.

%C 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

%C 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

%C 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

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

%H Alois P. Heinz, <a href="/A105927/b105927.txt">Table of n, a(n) for n = 0..300</a>

%H C.-Y. Wang, P. Miska, I. Mező, <a href="http://doi.org/10.1016/j.disc.2016.10.012">The r-derangement numbers</a>, Discrete Mathematics 340.7 (2017): 1681-1692.

%F 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

%F a(n) ~ sqrt(Pi/2) * n^(n+5/2) / exp(n+1). - _Vaclav Kotesovec_, Sep 05 2014

%F a(n) = (n^2 + n + 1) * n!/e + O(1). - _Charles R Greathouse IV_, Apr 07 2017

%p a:= proc(n) option remember; `if`(n<3, n*(n-1),

%p n*(n-1)*(a(n-1)+a(n-2))/(n-2))

%p end:

%p seq(a(n), n=0..25); # _Alois P. Heinz_, Jun 03 2014

%t Table[(Subfactorial[n+2]-2Subfactorial[n+1]-Subfactorial[n])/2,{n,0,21}] (* _Geoffrey Critzer_, Jun 02 2014 *)

%o (PARI) s(n) = if( n<1, 1, n * s(n-1) + (-1)^n);

%o a(n) = (s(n + 2) - 2*s(n + 1) - s(n))/2; \\ _Indranil Ghosh_, Apr 06 2017

%Y Cf. A000153, A018934, A055790.

%K nonn

%O 0,3

%A _N. J. A. Sloane_, Apr 27 2005

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 24 11:49 EDT 2024. Contains 371936 sequences. (Running on oeis4.)