The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A109742 a(n) = d(n-1) + d(n-2) + (n-1)[d(n-2) + 2d(n-3) + d(n-4)], where d(n), the derangement numbers, are given in A000166. (Let d(n) = 0 if n < 0.) 1

%I #21 Aug 03 2021 19:01:52

%S 1,2,5,9,27,123,693,4653,36111,317583,3118617,33804177,400755267,

%T 5156954019,71572594557,1065571143093,16938122939703,286298719063863,

%U 5127206924693601,96975312507734553,1931609062232400747,40414621201681598667,886153986344092389957

%N a(n) = d(n-1) + d(n-2) + (n-1)[d(n-2) + 2d(n-3) + d(n-4)], where d(n), the derangement numbers, are given in A000166. (Let d(n) = 0 if n < 0.)

%H Y.-R. Liu and M. R. Murthy, <a href="http://dx.doi.org/10.1016/j.jcta.2004.11.004">Sieve methods in combinatorics</a>, J. Combinatorial Theory, Ser. A, 111 (2005), 1-23.

%t a[1] = 1; a[2] = 2; a[3] = 5; a[n_] := a[n] = ((2*n^3 - 27*n^2 + 115*n - 150)*a[n - 3] + (2*n^3 - 23*n^2 + 85*n - 100)*a[n - 2] + 3*(2*n - 9)*a[n - 1])/(2*n - 9); Table[a[n], {n, 1, 23}]

%t (* or: *)

%t d[n_] := If[n < 0, 0, Subfactorial[n]]; Table[(n - 1)*(d[n - 4] + 2*d[n - 3] + d[n - 2]) + d[n - 2] + d[n - 1], {n, 1, 23}](* _Jean-François Alcover_, Nov 03 2016 *)

%o (PARI) d(n)=if(n>0, n!\/exp(1), n==0)

%o a(n)=d(n-1) + d(n-2) + (n-1)*(d(n-2) + 2*d(n-3) + d(n-4)) \\ _Charles R Greathouse IV_, Nov 03 2016

%Y Cf. A000166, A109743.

%K nonn

%O 1,2

%A _N. J. A. Sloane_, Aug 13 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 May 23 04:41 EDT 2024. Contains 372758 sequences. (Running on oeis4.)