OFFSET
1,6
COMMENTS
a(n) is the number of maximally balanced binary rooted trees with n leaves according to the Colless imbalance index. It is bounded above by sequence A299037.
LINKS
Andrei Zabolotskii, Table of n, a(n) for n = 1..4096 (terms 1..512 from Mareike Fischer)
Tomás M. Coronado and Francesc Rosselló, The minimum value of the Colless index arXiv:1903.11670 [q-bio.PE], 2019.
Mareike Fischer, Lina Herbst, and Kristina Wicke, Extremal properties of the Colless tree balance index for rooted binary trees, arXiv:1904.09771 [math.CO], 2019.
Tree Balance, Colless index
FORMULA
a(1)=1; a(n) = Sum_{(n_a,n_b): n_a+n_b=n, n_a > n_b, (n_a,n_b) in QB(n)} ( a(n_a)* a(n_b)) +f(n), where f(n)=0 if n is odd and f(n)= binomial(a(n/2)+1,2) if n is even; and where QB(n)={(n_a,n_b): n_a+n_b=n and such that there exists a tree T on n leaves with minimal Colless index and with leaf partitioning (n_a,n_b) }.
EXAMPLE
There are 13 trees with minimal Colless index and 23 leaves, i.e. a(23)=13.
MATHEMATICA
QB[n_?EvenQ] := Append[With[{k=IntegerExponent[n, 2]}, 2^k QB[n/2^k]], {n/2, n/2}];
QB[1] = {};
QB[n_] := QB[n] = Module[{bin = IntegerDigits[n, 2], m, qb = {{(n+1)/2, (n-1)/2}}, t},
m = Length[bin] - Flatten@Position[bin, 1];
Do[
t = Sum[2^(m[[i]] - 1), {i, j - 1}];
If[m[[j-1]] - m[[j]] > 1,
AppendTo[qb, {n - t, t}]];
If[m[[j]] - m[[j+1]] > 1,
t+=2^m[[j]];
AppendTo[qb, {t, n - t}]];
, {j, 2, Length[m]-1}];
qb
];
a[1] = 1;
a[n_] := a[n] = Module[{na, nb},
Sum[{na, nb} = nab;
If[na != nb, a[na] a[nb], Binomial[a[n/2] + 1, 2]]
, {nab, QB[n]}]
]; (* Edited by Andrei Zabolotskii, Apr 10 2026 *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Mareike Fischer, Apr 22 2019
STATUS
approved
