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.

A317012 Total number of elements in all permutations of [n], [n+1], ... that result in a binary search tree of height n.

Original entry on oeis.org

0, 1, 10, 1316, 840124672, 6110726696100443604557936, 439451426203104201222708341688051362423089952907263634936946272224
Offset: 0

Views

Author

Alois P. Heinz, Jul 18 2018

Keywords

Comments

Empty external nodes are counted in determining the height of a search tree.

Examples

			a(2) = 10 = 2 + 3 + 3 + 2:
.
         2           2           1
        / \         / \         / \
       1   o       1   3       o   2
      / \         ( ) ( )         / \
     o   o        o o o o        o   o
      (2,1)   (2,1,3) (2,3,1)   (1,2)
.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, k) option remember; `if`(n<2, `if`(k b(n, k)-b(n, k-1):
    a:= k-> add(T(n, k)*n, n=k..2^k-1):
    seq(a(n), n=0..6);
  • Mathematica
    b[n_, k_] := b[n, k] = If[n < 2, If[k < n, 0, 1],
      Sum[Binomial[n-1, r] b[r, k-1] b[n-1-r, k-1], {r, 0, n-1}]];
    T[n_, k_] := b[n, k] - b[n, k-1];
    a[k_] := Sum[T[n, k] n, {n, k, 2^k - 1}];
    a /@ Range[0, 6] (* Jean-François Alcover, Jan 27 2021, after Alois P. Heinz *)

Formula

a(n) = Sum_{k=n..2^n-1} k * A195581(k,n) = Sum_{k=n..2^n-1} k * A244108(k,n).