A335833 Triangle read by rows. T(n,k) is the number of full binary trees with n leaves and with k internal nodes whose left and right children have the same number of leaf descendants, where n > 0 and 0 <= k < n.
1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 4, 3, 3, 0, 0, 0, 1, 6, 7, 6, 3, 0, 1, 0, 1, 9, 14, 13, 8, 1, 1, 0, 0, 1, 12, 27, 28, 23, 8, 3, 1, 0, 0, 1, 16, 49, 58, 54, 25, 8, 3, 0, 0, 0, 1, 20, 82, 119, 125, 82, 34, 15, 2, 1, 0
Offset: 1
Examples
The table for T(n,k) begins: n\k 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 1 2 0 1 3 0 1 0 4 0 1 0 1 5 0 1 1 1 0 6 0 1 2 2 1 0 7 0 1 4 3 3 0 0 8 0 1 6 7 6 3 0 1 9 0 1 9 14 13 8 1 1 0 10 0 1 12 27 28 23 8 3 1 0 11 0 1 16 49 58 54 25 8 3 0 0 12 0 1 20 82 119 125 82 34 15 2 1 0 13 0 1 25 132 237 270 213 99 42 8 3 0 0 14 0 1 30 199 449 578 542 322 151 51 11 3 0 0 15 0 1 36 294 821 1190 1255 867 440 173 39 15 0 0 0 16 0 1 42 414 1419 2394 2841 2338 1388 656 215 79 18 7 0 1 ... The complete set of non-isomorphic 4-leaf SD-trees is: D S / \ / \ D * S S / \ /| |\ S * * * * * / \ * * T(6,2) = 2 gives the first example of a set of parameters n and k that has more than one non-isomorphic SD-tree. The complete set of non-isomorphic 6-leaf 2-S-node SD-trees is: D D / \ / \ D S D * / \ |\ / \ D * * * D S / \ / \ |\ S * S * * * / \ / \ * * * * From _Andrew Howroyd_, Apr 12 2023: (Start) When n = 8 there are two trees, illustrated below, which are isomorphic (up to exchange of left and right children), but are counted separately by this sequence: S S / \ / \ D S S D / | | \ / | | \ D * S S S S D * / \ /| |\ /| |\ | \ S * * * * * * * * * S * / \ / \ * * * * (End)
Links
- Andrew Howroyd, Table of n, a(n) for n = 1..1275 (first 50 rows).
- Laura Monroe, A Class of Trees Having Near-Best Balance, arXiv:2108.11496 [cs.DM], 2021.
- Laura Monroe and Vanessa Job, Computationally Inequivalent Summations and Their Parenthetic Forms, arXiv:2005.05387 [cs.DM], 2020.
Programs
-
Julia
using Memoize @memoize function T(n, k) k > n-1 && return 0 (n==1) && (k==0) && return 1 t, h = 0, n>>1 for j in 1:h-1, i in 0:k t += T(j, i)*T(n-j, k-i) end if n&1 > 0 for i in 0:k t += T(h, i)*T(h+1, k-i) end else for i in 0:k t += T(h, i)*T(h, k-i-1) end end t end for n in 1:16 [T(n,k) for k in 0:n-1] |> println end # Peter Luschny, Jun 26 2020
-
PARI
T(n)={my(v=vector(n)); v[1] = 1; for(n=2, n, v[n] = (polcoef(Ser(v[1..n])^2, n-2) + if(n%2==0, (2*y-1)*v[n/2]^2))/2); vector(#v, n, Vecrev(v[n], n))} { my(A=T(12)); for(n=1, #A, print(A[n])) } \\ Andrew Howroyd, Mar 25 2023
Formula
T(n,k) = 0, if k >= n. T(n,k) = 1, if n = 1 and k = 0.
T(n,k) = Sum_{j=1..floor((n-1)/2)} Sum_{i=0..k} T(j,i)*T(n-j,k-i), if n is odd and > 1.
T(n,k) = Sum_{j=1..floor((n-1)/2)} Sum_{i=0..k} T(j,i)*T(n-j,k-i) + Sum_{i=0..k-1} T(n/2,i)*T(n/2,k-1-i), if n is even.
Comments