OFFSET
0,3
LINKS
Vaclav Kotesovec, Table of n, a(n) for n = 0..264 (terms 0..200 from Alois P. Heinz)
Vaclav Kotesovec, What is the limit a(n)/2^n ?
EXAMPLE
a(0) = 1: the empty composition.
a(1) = 1: [1].
a(2) = 2: [1,1], [2].
a(3) = 2: [1,1,1], [3].
a(4) = 6: [1,1,1,1], [1,1,2], [1,2,1], [2,1,1], [2,2], [4].
a(5) = 12: [1,1,1,1,1], [1,1,1,2], [1,1,2,1], [1,2,1,1], [2,1,1,1], [1,2,2], [2,1,2], [2,2,1], [1,1,3], [1,3,1], [3,1,1], [5].
MAPLE
b:= proc(n, i, s) option remember; `if`(n=0, add(j, j=s)!,
`if`(i<1, 0, add(`if`(j>0 and j in s, 0,
b(n-i*j, i-1, `if`(j=0, s, s union {j}))/j!), j=0..n/i)))
end:
a:= n-> b(n$2, {}):
seq(a(n), n=0..45);
MATHEMATICA
b[n_, i_, s_] := b[n, i, s] = If[n == 0, Sum[j, {j, s}]!, If[i < 1, 0, Sum[If[j > 0 && MemberQ[s, j], 0, b[n - i*j, i - 1, If[j == 0, s, s ~Union~ {j}]]/j!], {j, 0, n/i}]]];
a[n_] := b[n, n, {}];
Table[a[n], {n, 0, 45}] (* Jean-François Alcover, May 17 2018, translated from Maple *)
PROG
(PARI) a(n)={((r, k, b, w)->if(!k||!r, if(r, 0, w!), sum(m=0, r\k, if(!m || !bittest(b, m), self()(r-k*m, k-1, bitor(b, 1<<m), w+m)/m!))))(n, n, 1, 0)} \\ Andrew Howroyd, Aug 31 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, May 25 2014
STATUS
approved