Number of times a bouncing ball will exceed a given height (Full disclosure: this question relates to programming logic in a JavaScript problem I am working on, hence its "simplicity".)
A ball is dropped from a given height and bounces one dimensionally (up and down). With each bounce, the ball climbs 2/3 the height of its previous bounce.
How can I calculate the number of times the ball will bounce higher than a specific height? We can assume this target height is lower than the height at which the ball was originally dropped.
My current solution checks the height of each bounce against the target height, incrementally adding 1 to the solution each time. This is inefficient, however, particularly in such cases where there is a substantial difference between the original height and the target height. For example: if the ball is dropped from 100,000 feet, bouncing up to 2/3 its previous height each time, how many times will it bounce higher than 1 foot?
 A: It is not as inefficient as you think. To go from $100,000$ to $1$ we want to know $n$ such that $(\frac{2}{3})^n = \frac{1}{100,000}$. Taking the natural log of both sides gives $n\ln\frac{2}{3}=\ln \frac{1}{100,000}\implies n\approx 28.4$. Since $n$ must be an integer your while loop will only iterate $29$ times.
A: Let $h_o$ be the initial height of the ball and $h_n$ be the height the ball reaches after $n$ bounces. Since with each bounce the ball climbs to two-thirds its previous height, we find that $h_n=(\frac{2}{3})^n h_o$. Dividing both sides by $h_o$, we find that $\frac{h_n}{h_o}=(\frac{2}{3})^n$. Taking the logarithm with base two-thirds of both sides, we find that $n=log_{\ 2/3}(\frac{h_n}{h_o})$. Substitute $h_n$ with the specific height and round down, then you should get your answer.
For example: If the ball is dropped from 100,000 ft and you want to see how many times it bounces higher than 1 ft, we find $n=log_{\ 2/3}(\frac{1}{100,000}) \approx 28.4$. Rounding down, we find the ball bounces 28 times before it goes below 1 ft.
A: The number of times the ball bounces above a target height after being dropped from the original height should be floor(n)  where $n=\log(target/original)/\log(2/3)$. You can take the log in any base. You can see that I just solved the equation original x $(2/3)^n\leq$ target. 
