OFFSET
1,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..50
Per Alexandersson et al., d-regular partitions and permutations, MathOverflow, 2014
EXAMPLE
a(2) = 1: (1,2).
a(3) = 4: (1,2,3), (1,3,2), (1)(2,3), (1,2)(3).
MAPLE
b:= proc(n, i, l) option remember; `if`(n=0, mul(j!, j=l),
(m-> add(`if`(i=j, 0, b(n-1, j, `if`(j>m, [l[], 0],
subsop(j=l[j]+1, l)))), j=1..m+1))(nops(l)))
end:
a:= n-> `if`(n=1, 1, n!-b(n, 0, [])):
seq(a(n), n=1..15);
MATHEMATICA
b[n_, i_, l_] := b[n, i, l] = If[n == 0, Product[j!, {j, l}], Function[m, Sum[If[i == j, 0, b[n - 1, j, If[j > m, Append[l, 0], ReplacePart[l, j -> l[[j]] + 1]]]], {j, 1, m + 1}]][Length[l]]];
a[n_] := If[n == 1, 1, n! - b[n, 0, {}]];
Array[a, 15] (* Jean-François Alcover, Oct 28 2020, after Maple code *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Sep 23 2016
STATUS
approved