May be you know about famous problem for its answer.
Place two billiard balls ($B_1$ and $B_2$) on the half-line $[0,\infty)$: the $B_1$ is at rest, the $B_2$ is to the right of it and is moving the left. At $x=0$ there is an elastic wall. Assume perfectly elastic collisions: the kinetic energy is preserved. How many collisions will happen depends on the masses of the ball, or rather their ratio.
For more details see Here.
Let me change condition of this problem a bit.
Place two billiard balls ($B_1$ and $B_2$). Both are at rest. Next, place one more ball $B_0$ between $B_1$ and $B_2$ which moves to the ball $B_2$. Every collision is elastic: kinetic energy is preserved. The same question.
We can begin with simple case when masses of $B_1$ and $B_2$ are equal to $M$ and mass of $B_0$ is equal to $m$.
I tried to solve this and my result is a system of recurrences which I am not able to solve. I will post my solution below.