Let's do graphs to this puzzle.
(Spoiler alert: I spoiler tagged the bare minimum to keep this even halfway readable)
First we need to figure out what to plot. Since the game is "elastic collisions", plotting the conservation laws for momentum and kinetic energy is probably a good idea.
$$m_Bv_B + m_Sv_S = constant$$
$$m_Bv_B^2 + m_Sv_S^2 = constant$$
where the "m"s are masses, "v"s are velocities, and the subscript B and S mean the "big object" and the "small object" respectively.
(If you wonder where the "$\frac{1}{2}$"s from the conservation of kinetic energy disappeared, I dropped them for convenience: two times a constant is still a constant, just some other one.)
Plotting these with the velocities as the coordinate axes should give us a straight line for the first one, and some second order curve for the latter.
To plot the latter law, let's divide everything by $m_Bm_S$, and then choose the units so that the right side becomes one:
$$ \frac{v_B^2}{m_S} + \frac{v_S^2}{m_B}=1 $$
This we instantly recognise as a formula for an ellipse with the square roots of the masses as the semi-axes.
So let's go ahead and plot them. Let's use 9kg as the bigger mass to make the plot readable. (Sorry about the axis labels, they're from an earlier attempt that the PSE captcha checker ate. Please mentally substitute B for 1 and S for 2.)

It's important to notice that any line parallel with the red one will conserve momentum, and that our two speeds can never be anywhere else than on the blue ellipse.
In the initial state, we are at the top of the ellipse (all speed on the big mass).
Any collision between the masses must conserve momentum, so we move in the direction of the red line until we hit another point on the ellipse.
When the smaller mass hits the wall, its speed is reversed while the big mass's speed stays unaffected. So we can plot the consecutive states on the graph like this:

To reiterate, the red transitions represent the two masses colliding, the green ones represent the smaller mass hitting the wall.
Here we had a mass ratio of 9:1 and by my freehand graphing, we got 9 collisions. Coincidence? Most likely. But let's see..
Ellipses are hard. Let's scale the horizontal axis down by the square root of the weight ratio which is 3 in this case:

As you can probably see, I literally told gimp to scale the image from earlier.
This triples the slope of the "conservation of momentum" lines, and, more importantly, turns the blue "conservation of kinetic energy" curve into a unit circle. Now THAT's progress.
The midpoint of the circle arc spanned by the red line from "start" to "1" looks important. If we draw a line through it and the circle's center, we get a line that's perpendicular to all the red lines:

I've used theta (θ) to mark the angle that the important line makes with the vertical, since now we can find all the other collision points as multiples of θ: The momentum-conserving red lines are all perpendicular to the important line, so a collision between the two masses mirrors the state to the other side of the important line, and a collision between the smaller mass and the wall just negates the angle.
Collision angle from vertical, in theta units
1 2
2 -2
3 4
4 -4
5 6
6 -6
And there's the pattern we need to solve the puzzle. Calculating how many thetas we need to traverse the required half circle will directly tell us the number of collisions needed.
Let's first calculate the accurate value for the 9:1 weight ratio case. We know that the slope of the red lines is $-\frac{1}{\sqrt9}$, and that we can also find theta as its angle from the horizontal:
$$ \theta = -arctan(-\frac{1}{\sqrt9})$$
and so the required number of bounces is
$$\frac{\pi}{\theta} = \frac{\pi}{-arctan(-\frac{1}{\sqrt9})} \approx 9.8 $$
which quite encouragingly agrees with the drawing from earlier.
Finally, replacing the "9" in the above formula with 1,000,000, we get
$$ \textbf{Number of collisions} = \frac{\pi}{-arctan(-\frac{1}{\sqrt{1,000,000}})} \approx \mathbf{3141} $$
and even more finally, applying a small angle approximation of $arctan(\theta) \approx \theta$, a general result would be
$$\text{Number of collisions} \approx \pi\sqrt{\frac{m_B}{m_S}}$$
which applies as long as the big mass is much larger than the small one.
I've invested way more time to this puzzle than intended, so instead of triple checking, I'm going to have to let you guys point out all my mistakes :-)