cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-4 of 4 results.

A299767 Partial sums of A299037.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 8, 9, 10, 13, 16, 21, 24, 27, 28, 29, 30, 34, 40, 54, 71, 98, 126, 161, 189, 216, 233, 247, 253, 257, 258, 259, 260, 265, 275, 305, 360, 481, 688, 1066, 1641, 2535, 3752, 5403, 7396, 9769, 12315, 14997, 17543, 19916, 21909, 23560, 24777, 25671, 26246, 26624, 26831, 26952, 27007, 27037
Offset: 1

Views

Author

Omar E. Pol, Mar 01 2018

Keywords

Crossrefs

Cf. A299037.

Formula

a(n) = Sum_{k=1..n} A299037(k).

A345135 Number of ordered rooted binary trees with n leaves and with minimal Sackin tree balance index.

Original entry on oeis.org

1, 1, 1, 2, 1, 4, 6, 4, 1, 8, 28, 56, 70, 56, 28, 8, 1, 16, 120, 560, 1820, 4368, 8008, 11440, 12870, 11440, 8008, 4368, 1820, 560, 120, 16, 1, 32, 496, 4960, 35960, 201376, 906192, 3365856, 10518300, 28048800, 64512240, 129024480, 225792840, 347373600, 471435600
Offset: 0

Views

Author

Mareike Fischer, Jun 09 2021

Keywords

Comments

Ordered rooted binary trees are trees with two descendants per inner node where left and right are distinguished.
The Sackin tree balance index is also known as total external path length.
a(0) = 1 by convention.

Examples

			a(1) = a(2) = 1 because there are only the trees (o) and (o,o) which get counted. a(3) = 2 because the trees ((o,o),o) and (o,(o,o)) get counted. a(4) = 1 because only the tree ((o,o),(o,o)) is counted. Note that the other possible rooted binary ordered trees with four leaves, namely the different orderings of (((o,o),o),o), are not Sackin minimal. a(5) = 4 because the following trees get counted: (((o,o),o),(o,o)), ((o,(o,o)),(o,o)), ((o,o),((o,o),o)), ((o,o),(o,(o,o))).
		

Crossrefs

Programs

  • Maple
    a:= n-> (b-> binomial(b, n-b))(2^ilog2(n)):
    seq(a(n), n=0..46);  # Alois P. Heinz, Jun 09 2021
  • Mathematica
    a[0] := 1; a[n_] := Module[{k = 2^(BitLength[n] - 1)}, Binomial[k, n - k]];
    Table[a[n], {n, 0, 46}]

Formula

a(n) = binomial(2^(ceiling(log_2(n))-1),n-2^(ceiling(log_2(n))-1)).
a(n) = binomial(A053644(n),n-A053644(n)).
a(2^n) = 1.
a(2^n-1) = A011782(n).
a(2^n+1) = A000079(n).
From Alois P. Heinz, Jun 09 2021: (Start)
max({ a(k) | k = 2^n..2^(n+1) }) = A037293(n).
Sum_{i=2^n..2^(n+1)-1} a(i) = 2^(2^n) - 1 = A051179(n). (End)
Conjecture: Sum_{n>=0} a(n)*x^n = 1 + x + Sum_{n>=0} x^(2^n) * ((1 + x)^(2^n) - 1). - Paul D. Hanna, Jul 18 2024

A307689 The number of rooted binary trees on n leaves with minimal Colless index.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 1, 1, 3, 3, 4, 3, 3, 1, 1, 1, 4, 6, 10, 16, 21, 13, 11, 13, 21, 16, 10, 6, 4, 1, 1, 1, 5, 10, 20, 50, 82, 73, 66, 184, 411, 548, 351, 455, 326, 144, 67, 144, 326, 455, 351, 548, 411, 184, 66, 73, 82, 50, 20, 10, 5, 1, 1
Offset: 1

Views

Author

Mareike Fischer, Apr 22 2019

Keywords

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.

Examples

			There are 13 trees with minimal Colless index and 23 leaves, i.e. a(23)=13.
		

Crossrefs

The sequence is bounded above by A299037.
The sequence of the number of trees with minimal Colless index is also linked to the values of the minimal Colless index as given by A296062.

Programs

  • Mathematica
    (*QB[n] is just a support function -- the function that actually generates the sequence of the numbers of trees with minimal Colless index and n leaves is given by minCbasedonQB; see below*)
    QB[n_] := Module[{k, n0, bin, l, m = {}, i, length, qb = {}, j},
      If[OddQ[n], k = 0,
       k = FactorInteger[n][[1]][[2]];
       ];
      n0 = n/(2^k);
      bin = IntegerDigits[n0, 2];
      length = Length[bin];
      For[i = Length[bin], i >= 1, i--,
       If[bin[[i]] != 0, PrependTo[m, length - i]];
       ];
      l = Length[m];
      If[l == 1, Return[{{n/2, n/2}}],
       AppendTo[
        qb, {2^k*(Sum[2^(m[[i]] - 1), {i, 1, l - 1}] + 1),
         2^k*(Sum[2^(m[[i]] - 1), {i, 1, l - 1}])}];
       For[j = 2, j <= l - 1, j++,
        If[m[[j]] > m[[j + 1]] + 1,
         AppendTo[
          qb, {2^k*(Sum[2^(m[[i]] - 1), {i, 1, j - 1}] + 2^m[[j]]),
           n - 2^k*(Sum[2^(m[[i]] - 1), {i, 1, j - 1}] + 2^m[[j]])}]];
        If[m[[j]] < m[[j - 1]] - 1,
         AppendTo[
          qb, {n - 2^k*Sum[2^(m[[i]] - 1), {i, 1, j - 1}],
           2^k*Sum[2^(m[[i]] - 1), {i, 1, j - 1}]}]];
        ];
       If[k >= 1, AppendTo[qb, {n/2, n/2}]];
       Return[qb];
       ];
      ]
    minCbasedonQB[n_] := Module[{qb = QB[n], min = 0, i, na, nb},
      If[n == 1, Return[1],
       For[i = 1, i <= Length[qb], i++,
        na = qb[[i]][[1]]; nb = qb[[i]][[2]];
        If[na != nb, min = min + minCbasedonQB[na]*minCbasedonQB[nb],
         min = min + Binomial[minCbasedonQB[n/2] + 1, 2]];
        ];
       Return[min];
       ]
      ]

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)} }.

A344934 Number of rooted binary phylogenetic trees with n leaves and minimal Sackin tree balance index.

Original entry on oeis.org

1, 1, 3, 3, 30, 135, 315, 315, 11340, 198450, 2182950, 16372125, 85135050, 297972675, 638512875, 638512875, 86837751000, 5861548192500, 259861969867500, 8445514020693750, 212826953321482500, 4292010225316563750, 70511596558772118750, 951906553543423603125, 10576739483815817812500, 96248329302723942093750
Offset: 1

Views

Author

Mareike Fischer, Jun 09 2021

Keywords

Comments

Rooted binary phylogenetic trees with n leaves are rooted trees for which each internal node has precisely two children and whose leaves are bijectively labeled by the set {1,...,n}.

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{k = Ceiling[Log2[n]], int, na, nb, sum, i},
      If[n == 1, Return[1],
       int = IntegerPartitions[n, {2}];
       If[OddQ[n], sum = 0, sum = 1/2*Binomial[n, n/2]*((a[n/2])^2)];
       For[i = 1, i <= Length[int], i++,
        na = int[[i]][[1]]; nb = int[[i]][[2]];
        If[na > n/2 && na <= 2^(k - 1) && nb >= 2^(k - 2),
         sum = sum + Binomial[n, na]*a[na]*a[nb];
         ];
        ];
       Return[sum];
       ]]
  • PARI
    seq(n)={my(a=vector(n)); a[1]=1; for(n=2, #a, my(k=1+logint(n-1,2)); a[n]=if(n%2==0, a[n/2]*binomial(n,n/2)/2) + sum(i=n\2+1, min(2^(k-1), n-2^(k-2)), binomial(n,i)*a[i]*a[n-i])); a} \\ Andrew Howroyd, Jun 09 2021

Formula

With k:=log_2(n) and g(n):=0 if n is odd and g(n) := (1/2)*binomial(n,n/2)*a(n/2) if n is even and pairs := set of all pairs (na,nb) such that na+nb=n and na >= nb and na > n/2 and na <= 2^(k-1) and nb >= 2^(k-2), we get:
a(n) = g(n) + sum over all described pairs (na,nb): binomial(n,na)*a(na)*a(nb).
a(n) = g(n) + Sum_{i=floor(n/2)+1..2^(k-1), i <= 2^(k-2)} binomial(n,i)*a(i)*a(n-i), where k = ceiling(log_2(n)) and g(n)=0 for odd n, g(n) = binomial(n,n/2)*a(n/2)/2 for even n.
Showing 1-4 of 4 results.