Two blocks, a wall, perfectly elastic collisions. No circle appears anywhere in the statement of the problem. The collisions count out the digits of π.
On the left, a small block is struck by a heavy one and rattles between it and the wall. Nothing about that picture suggests π. On the right is the identical system in coordinates y₁ = √m₁·x₁, y₂ = √m₂·x₂, where kinetic energy becomes the squared length of the velocity vector.
In those coordinates the speed can never change, so every collision is a reflection, and the allowed region — the small block right of the wall, the big block right of the small one — is a wedge. The whole problem becomes a straight line bouncing inside a wedge of angle θ = arctan√(m₁/m₂), and the number of bounces is just how many times θ fits into π.
Why the digits of π and not merely something near π. With m₂/m₁ = 100ⁿ, the angle is θ = arctan(10⁻ⁿ), and arctan x → x as x → 0. So π/θ → π×10ⁿ, and taking the integer part reads off π's decimal expansion one digit at a time. The blocks are not computing π. They are turning through a fixed total angle, and the count of reflections is forced by geometry.
The exact count is ⌈π/θ⌉ − 1, not ⌈π/θ⌉. The equal-mass case is what exposes the difference: there θ = π/4 exactly, π/θ = 4, and the answer is 3. An earlier draft of the companion script had the formula without the −1 and was wrong on every row by exactly one.
This page advances the system event to event rather than by time steps: the next wall bounce and the next block–block meeting are each solved for exactly, and the earlier one is taken. There is no tunnelling and no step size, so the collision count is not an artefact of resolution. The same physics, in exact rational arithmetic, is in galperin-billiards-verify.py, which reproduces 3, 31, 314 with no rounding anywhere and confirms the closed form out to 31415926.
The result is Gregory Galperin's, Playing pool with π, Regular and Chaotic Dynamics 8 (2003) 375–394. It reached this project through Grant Sanderson's exposition — cited for the mathematics, told for the route, in the provenance grading this series adopted in the Hardy chapter.