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.

A335920 Number T(n,k) of binary search trees of height k having n internal nodes; triangle T(n,k), k>=0, k<=n<=2^k-1, read by columns.

This page as a plain text file.
%I A335920 #25 Feb 08 2021 17:41:14
%S A335920 1,1,2,1,4,6,6,4,1,8,20,40,68,94,114,116,94,60,28,8,1,16,56,152,376,
%T A335920 844,1744,3340,5976,10040,15856,23460,32398,41658,49700,54746,55308,
%U A335920 50788,41944,30782,19788,10948,5096,1932,568,120,16,1,32,144,480,1440,4056
%N A335920 Number T(n,k) of binary search trees of height k having n internal nodes; triangle T(n,k), k>=0, k<=n<=2^k-1, read by columns.
%C A335920 Empty external nodes are counted in determining the height of a search tree.
%C A335920 T(n,k) is defined for n,k >= 0. The triangle contains only the positive terms. Terms not shown are zero.
%H A335920 Alois P. Heinz, <a href="/A335920/b335920.txt">Columns k = 0..10, flattened</a>
%H A335920 Wikipedia, <a href="https://en.wikipedia.org/wiki/Binary_search_tree">Binary search tree</a>
%H A335920 <a href="/index/Ro#rooted">Index entries for sequences related to rooted trees</a>
%H A335920 <a href="/index/Tra#trees">Index entries for sequences related to trees</a>
%F A335920 Sum_{k=0..n} k * T(n,k) = A335921(n).
%F A335920 Sum_{n=k..2^k-1} n * T(n,k) = A335922(k).
%e A335920 Triangle T(n,k) begins:
%e A335920   1;
%e A335920      1;
%e A335920         2;
%e A335920         1, 4;
%e A335920            6,   8;
%e A335920            6,  20,   16;
%e A335920            4,  40,   56,   32;
%e A335920            1,  68,  152,  144,   64;
%e A335920                94,  376,  480,  352,  128;
%e A335920               114,  844, 1440, 1376,  832,  256;
%e A335920               116, 1744, 4056, 4736, 3712, 1920, 512;
%e A335920   ...
%p A335920 b:= proc(n, h) option remember; `if`(n=0, 1, `if`(n<2^h,
%p A335920       add(b(j-1, h-1)*b(n-j, h-1), j=1..n), 0))
%p A335920     end:
%p A335920 T:= (n, k)-> b(n, k)-`if`(k>0, b(n, k-1), 0):
%p A335920 seq(seq(T(n, k), n=k..2^k-1), k=0..6);
%t A335920 b[n_, h_] := b[n, h] = If[n == 0, 1, If[n < 2^h,
%t A335920      Sum[b[j - 1, h - 1]*b[n - j, h - 1], {j, 1, n}], 0]];
%t A335920 T[n_, k_] := b[n, k] - If[k > 0, b[n, k - 1], 0];
%t A335920 Table[Table[T[n, k], {n, k, 2^k - 1}], {k, 0, 6}] // Flatten (* _Jean-François Alcover_, Feb 08 2021, after _Alois P. Heinz_ *)
%Y A335920 Row sums give A000108.
%Y A335920 Column sums give A001699.
%Y A335920 Main diagonal gives A011782.
%Y A335920 T(n+3,n+2) gives A014480.
%Y A335920 T(n,max(0,A000523(n)+1)) = A328349(n).
%Y A335920 Cf. A073345, A076615, A195581, A244108, A335919 (the same read by rows), A335921, A335922.
%K A335920 nonn,tabf
%O A335920 0,3
%A A335920 _Alois P. Heinz_, Jun 29 2020