OFFSET
1,3
COMMENTS
An unlabeled rooted tree is leaf-balanced if every branch has the same number of leaves and every non-leaf rooted subtree is also leaf-balanced.
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..50
EXAMPLE
The a(5)=8 leaf-balanced trees are: ((((o)))), (((oo))), ((o(o))), ((ooo)), (o((o))), ((o)(o)), (oo(o)), (oooo). The tree (o(oo)) is not leaf-balanced.
MATHEMATICA
allbal[n_]:=allbal[n]=If[n===1, {{}}, Join@@Function[c, Select[Union[Sort/@Tuples[allbal/@c]], SameQ@@(Count[#, {}, {0, Infinity}]&/@#)&]]/@IntegerPartitions[n-1]];
Table[Length[allbal[n]], {n, 15}]
PROG
(PARI)
PartitionProduct(p, f)={my(r=1, k=0); for(i=1, length(p), if(i==length(p) || p[i]!=p[i+1], r*=f(p[i], i-k); k=i)); r}
UPick(total, kinds)=binomial(total+kinds-1, kinds-1);
D(n)={my(v=vector(n)); v[1]=[1]; for(n=2, n, v[n]=vector(n-1); forpart(p=n-1, for(leaves=1, length(v[p[1]]), v[n][leaves*length(p)]+=PartitionProduct(p, (t, e)->UPick(e, v[t][leaves]))))); v}
a(n)=vecsum(D(n)[n]); \\ Andrew Howroyd, Sep 02 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Aug 23 2017
EXTENSIONS
Terms a(26) and beyond from Andrew Howroyd, Sep 02 2017
STATUS
approved