Let's assume that the B-tree has, on average, a entries in each node, and b child nodes per node:
In that case, the number of entries in the tree follows a finite geometric series with a ratio of b and the first term equalling a:
N = a + ab + ab2 + ab3 + ... + abn
= a(1-bn+1)/(1-b)
N(1-b)/a = 1-bn+1
bn+1 = 1 - N(1-b)/a
n = logb(1 - N(1-b)/a) - 1