### classical mechanics

Balls to the wall

A ball of mass $m$ sits at rest in between a wall and another ball of mas $100^n\, m$ with $n$ a non-negative integer. The larger ball is about to collide elastically with the smaller ball. When it does, the smaller ball heads toward the wall, collides elastically with the wall, and eventually collides with the larger ball again. After a certain number of collisions, the larger ball's velocity will be fast enough that the smaller ball can no longer collide with it, and the collisions cease.
How many total collisions does the smaller ball make with both the wall and the larger ball before the collisions stop? The answer should be a function of $n$.
Partial answer: for $n=0$, there are $3$ collisions. For $n=1$, there are $31$ collisions. For $n=2$, there are $314$ collisions.