%I #21 Feb 20 2023 08:04:47
%S 1,0,3,18,189,2484,40095,766422,16936857,424878696,11929019931,
%T 370616958810,12624017298453,467806833261468,18736803171836919,
%U 806593620214132254,37139869052368612785,1821430208283971761872,94787073944153359107507,5216859224231615866946466
%N Derangement numbers d(n,3) where d(n,k) = k(n-1)(d(n-1,k) + d(n-2,k)), with d(0,k) = 1 and d(1,k) = 0.
%H Roland Bacher, <a href="https://www.combinatorics.org/ojs/index.php/eljc/article/view/v19i3p7">Counting Packings of Generic Subsets in Finite Groups</a>, Electr. J. Combinatorics, 19 (2012), #P7. - From _N. J. A. Sloane_, Feb 06 2013
%F Inverse binomial transform of A007559. E.g.f.: exp(-x)/(1-3*x)^(1/3). - _Vladeta Jovovic_, Dec 17 2003
%F a(n) = 3(n-1)(a(n-1)+a(n-2)), n>1. - _Gary Detlefs_, May 16 2010
%F a(n) ~ Gamma(2/3) * 3^(n + 1/2) * n^(n-1/6) / (sqrt(2*Pi) * exp(n + 1/3)). - _Vaclav Kotesovec_, Oct 31 2017
%e 3= 3*(1+0), 18 =6*(0+3), 189=9*(18+3), 2484=12*(189+18)... [From _Gary Detlefs_, May 16 2010]
%p k := 3; d := proc(n) global k; option remember; if n = 0 then RETURN(1) end if; if n = 1 then RETURN(0) end if; k*(n - 1)*(d(n - 1) + d(n - 2)) end proc;
%t d[n_, k_] := d[n, k] = k(n-1)(d[n-1, k] + d[n-2, k]);
%t d[0, _] = 1; d[1, _] = 0;
%t a[n_] := d[n, 3];
%t Table[a[n], {n, 0, 19}] (* _Jean-François Alcover_, Feb 20 2023 *)
%Y d(n, 1) gives A000166, d(n, 2) gives A053871, d(n, 4) gives A088991, d(n, 5) gives A088992.
%K nonn,easy
%O 0,3
%A _N. J. A. Sloane_, Nov 02 2003
|