Coin Streak Probability
Three things in one page: the plain probability of flipping N heads in a row; the expected number of flips to see a streak; and an honest simulation of what happens if you try to exploit streaks with the classic Martingale doubling strategy. As a bonus the St. Petersburg paradox calculator shows why "infinite expected value" games don't actually pay infinite.
Streak & wait
E(flips) = (p-N − 1)/(1 − p) (geometric waiting time for runs of length N).
Martingale ruin
Streak probability curve
St. Petersburg paradox (truncated at T)
Reward doubles every head before the first tail. Expected reward diverges as T → ∞, but realistic payouts are bounded.
Method note
- Probability of streak. For an i.i.d. fair coin,
P(N heads in a row) = pN. - Wait time. The number of flips needed to observe a run of N consecutive heads follows a geometric distribution with mean
(p-N − 1)/(1 − p)(Chen & Nedas, 2003). - Martingale ruin. We simulate the canonical "double after each loss until one win" strategy. With even-money payout and win prob < 0.5, expected value is negative but bounded only by bankroll. Higher bet caps and stop-successes interact non-linearly.
- St. Petersburg paradox. Truncated at T: E[T] = Σk=0T-1 2^k · p^k (1 − p) + (p^T)·2^T which for fair coin equals T + 1.
Who is this for?
Stats students
Run-length distributions are classic in Markov-chain modules. The closed-form waiting time and the St. Petersburg puzzle are exam-favourites.
Gambling-curious
If you have ever wondered "could I really be that unlucky", the ruin rate column will give you a numeric answer — not vibes.
Decision theorists
St. Petersburg exhibits why unbounded-looking expectations are not a foundation for rational pricing when median payouts stay tiny.
Interpretation
A streak of 10 heads in fair coin flipping happens with probability 0.097% — but in 1,000 flips you almost certainly see some 4- to 6-head streak. Streaks are not anomalies of the universe, they are the natural consequence of large samples. The right mental model is "what's the longest run I should expect?" rather than "what's wrong with my RNG?".
When not to trust this
- Real coins and rouletter wheels have slight bias. The p input handles that.
- Martingale sim assumes even-money (e.g. red/black) bets. Baccarat's tie bet, for example, has different payouts and ruin dynamics.
- Casino table limits kill the doubling property. The simulator doesn't know about them; treat results as a best-case for the strategy.
FAQ
Why does 10 heads in a row feel so common?
Because if you flip 1,000 coins you expect about 9 streaks of length 7 — and one streak of 9 or 10. We remember the streaks and forget the long runs of tails that precede them.
Why is Martingale ruin still under 100% at p=0.49?
Because the stop-successes condition. If you have to win only 10 in a row to cash out, most gamblers actually do — the problem is what they do on the 11th cycle.
What's the resolution to St. Petersburg?
Three mainstream answers: (1) expected value is the wrong criterion — use expected utility with a concave utility function (Bernoulli, 1738); (2) truncations reflect real constraints (Casino can't pay 2^T); (3) risk-aversion in the wager itself bounds fair price.
Same logic, bigger numbers.
What to bet if you can size it.
Multiply the streak logic.