OFFSET
0,4
COMMENTS
The cycle lengths are distinct as a consequence of the definition.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..450
Wikipedia, Permutation
EXAMPLE
a(3) = 3: (123), (132), (1)(23).
a(4) = 8: (1234), (1243), (1324), (1342), (1423), (1432), (1)(234), (1)(243).
MAPLE
a:= n-> add((n-nops(p))!, p=select(l-> nops(l)=
nops({l[]}), combinat[partition](n))):
seq(a(n), n=0..24);
# second Maple program:
b:= proc(n, i, p) option remember; `if`(i*(i+1)/2<n, 0,
`if`(n=0, p!, b(n, i-1, p)+b(n-i, min(n-i, i-1), p-1)))
end:
a:= n-> b(n$3):
seq(a(n), n=0..24);
MATHEMATICA
b[n_, i_, p_] := b[n, i, p] = If[i*(i + 1)/2 < n, 0, If[n == 0, p!, b[n, i - 1, p] + b[n - i, Min[n - i, i - 1], p - 1]]];
a[n_] := b[n, n, n];
Table[a[n], {n, 0, 24}] (* Jean-François Alcover, Nov 15 2023, from second Maple program *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jul 05 2023
STATUS
approved