The Coin Flip π Estimator

Did you know you can estimate π just by flipping a fair coin? This experiment follows a simple rule:

  1. Flip a coin until Heads strictly exceeds Tails.
  2. Record the ratio of Heads / Total Flips at that exact moment.
  3. Repeat this thousands of times and take the average ratio.

Remarkably, this average converges to π / 4.

Visualization of the longest experiment's path with - flips.
The goal is to cross the "surface" (Heads > Tails).

Average Ratio:
-
Estimated π:
(4 * Average Ratio)
-