OFFSET
1,2
LINKS
Y.-R. Liu and M. R. Murthy, Sieve methods in combinatorics, J. Combinatorial Theory, Ser. A, 111 (2005), 1-23.
MATHEMATICA
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}]
(* or: *)
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 *)
PROG
(PARI) d(n)=if(n>0, n!\/exp(1), n==0)
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
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Aug 13 2005
STATUS
approved