OFFSET
0,5
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..450
Wikipedia, Permutation
EXAMPLE
a(3) = 1: (13)(2).
a(4) = 2: (124)(3), (142)(3).
a(5) = 12: (1235)(4), (1253)(4), (1325)(4), (1352)(4), (1523)(4), (1532)(4),
(124)(35), (142)(35), (125)(34), (152)(34), (13)(245), (13)(254).
MAPLE
f:= proc(n) option remember; `if`(n<2, 1-n, (n-1)*(f(n-1)+f(n-2))) end:
a:= proc(m) option remember; local b; b:=
proc(n, i, p) option remember; `if`(i*(i+1)/2<n, 0,
`if`(n=0, p!*f(m-p), b(n, i-1, p)+b(n-i, min(n-i, i-1), p-1)))
end: b(m$3)
end:
seq(a(n), n=0..24);
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jul 17 2023
STATUS
approved