OFFSET
0,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..449
MAPLE
a:= proc(n) option remember; `if`(n<5, [0, 1$2, 7, 31][n+1],
((2*n^4-3*n^3-2*n^2+n+4)*a(n-1) -(n^5-4*n^4+7*n^2+6*n-14)*
a(n-2) -(n^5-2*n^4-4*n^3+2*n^2+13*n-12)*a(n-3)-(n-2)*
(n^3+2*n^2+n-2)*a(n-4))/(n^3-n^2-2))
end:
seq(a(n), n=0..23);
MATHEMATICA
menage[n_] := If[n == 0, 1, 2n Sum[(-1)^k Binomial[2n-k, k] (n-k)!/(2n-k), {k, 0, n}]];
a[n_] := If[n == 0, 0, Subfactorial[n+1] - menage[n+1]];
a /@ Range[0, 21] (* Jean-François Alcover, Oct 28 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Mar 09 2019
STATUS
approved