I'm trying to figure out a recursive formula for the number of possible distinct binary trees at any depth d. I haven't been able to find any sort of sources on this.
basically, at depth 0, the only binary tree is the empty one so 0, 1
then at depth 1 the only possibility is a single node so 1, 1
at depth = 2 there are 3 possibilities, and at depth 3 I counted 21 possibilities.
I haven't been able to figure out some recursive reasoning for what 4 could be and so on. The only thing I have in place is that there will always be 1 for the full tree.
Let $D_n$ be the number of distinct binary trees with depth $n$.
Let $L_n = \sum_0^n D_k$ be the number of distinct binary trees with length $n$ or less.
Then $D_n = 2 \cdot D_{n-1} \cdot L_{n-2} + D_{n-1}^2$
The first term counts the number of uneven trees (left subtree has different depth than right subtree) and the second term counts the number of even trees (left subtree has same depth as right subtree).