OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..300
EXAMPLE
a(2) = 4: 2ab, 1a1b. Both colors (a and b) are used twice: 2 + 2 = 4.
MAPLE
C:= binomial:
g:= proc(n) option remember; n*2^(n-1) end:
h:= proc(n) option remember; local k; for k from
`if`(n=0, 0, h(n-1)) do if g(k)>=n then return k fi od
end:
b:= proc(n, i, k) option remember; `if`(n=0, 1, `if`(i<1 or k<h(n),
0, add(b(n-i*j, min(n-i*j, i-1), k)*C(C(k, i), j), j=0..n/i)))
end:
a:= n-> add(k*add(b(n$2, i)*(-1)^(k-i)*C(k, i), i=0..k), k=h(n)..n):
seq(a(n), n=0..23);
MATHEMATICA
c = Binomial;
g[n_] := g[n] = n 2^(n - 1);
h[n_] := h[n] = Module[{k}, For[k = If[n == 0, 0, h[n - 1]] , True, k++, If [g[k] >= n , Return[k]]]];
b[n_, i_, k_] := b[n, i, k] = If[n == 0, 1, If[i < 1 || k < h[n], 0, Sum[b[n - i j, Min[n - i j, i - 1], k] c[c[k, i], j], {j, 0, n/i}]]];
a[n_] := Sum[k Sum[b[n, n, i] (-1)^(k-i) c[k, i], {i, 0, k}], {k, h[n], n}];
a /@ Range[0, 23] (* Jean-François Alcover, Dec 09 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Sep 13 2019
STATUS
approved