OFFSET
0,4
COMMENTS
A complete composition of n has element set [k] with k<=n (without gaps).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
EXAMPLE
a(1) = 1: 1.
a(2) = 1: 11.
a(3) = 5 = 2 + 2 + 1: 12, 21, 111.
a(4) = 7 = 2 + 2 + 2 + 1: 112, 121, 211, 1111.
a(5) = 15 = 7*2 + 1: 122, 212, 221, 1112, 1121, 1211, 2111, 11111.
MAPLE
g:= proc(n, i, t) `if`(n=0, `if`(i=0, t!, 0),
`if`(i<1 or n<i*(i+1)/2, 0, b(n, i, t)))
end:
b:= proc(n, i, t) option remember;
add(g(n-i*j, i-1, t+j)/j!, j=1..n/i)
end:
a:= n-> add(g(n, k, 0)*k, k=0..floor((sqrt(1+8*n)-1)/2)):
seq(a(n), n=0..33);
MATHEMATICA
g[n_, i_, t_] := If[n == 0, If[i == 0, t!, 0], If[i < 1 || n < i*(i+1)/2, 0, b[n, i, t]]];
b[n_, i_, t_] := b[n, i, t] = Sum[g[n-i*j, i-1, t+j]/j!, {j, 1, n/i}];
a[n_] := Sum[g[n, k, 0]*k, {k, 0, Floor[(Sqrt[1 + 8*n] - 1)/2]}];
Table[a[n], {n, 0, 33}] (* Jean-François Alcover, Jun 08 2024, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, May 31 2024
STATUS
approved