Quant Memo
Foundational

Expected Longest Streak of Heads

Why the longest run of consecutive heads in a long sequence of coin flips grows like log base 2 of the number of flips — and why streaks that feel 'too long to be luck' usually aren't.

Prerequisites: Expected Cards Until the First Ace

Question. Flip a fair coin 100 times. What's the expected length of the longest run of consecutive heads somewhere in that sequence? Intuition badly underestimates this one — most people guess something small, like 4 or 5, imagining that "long streaks are rare." The actual answer is around 7, and the reasoning behind it — approximate scaling with log2n\log_2 n — is a genuinely useful mental tool, not just a memorized fact.

Why the answer is bigger than intuition suggests

The mistake in the naive intuition is thinking about one specific run of, say, 6 heads in a row, and correctly noting that has probability (1/2)6=1/64(1/2)^6 = 1/64 — rare. But the question isn't about one specific position; it's about the longest run anywhere among 100 flips, and there are roughly 95 different starting positions where a run of length 6 could begin. With that many chances, even a 1/641/64-per-position event becomes likely to occur somewhere.

The scaling argument

A run of length kk starting at a given position has probability (1/2)k(1/2)^k. Across roughly nn starting positions in a sequence of nn flips, the expected number of length-kk runs is about n×(1/2)kn \times (1/2)^k. The longest run tends to sit right around the length kk^* where this expected count transitions from "many" to "essentially zero" — i.e., where n×(1/2)k1n \times (1/2)^{k^*} \approx 1:

n2k1klog2n.n \cdot 2^{-k^*} \approx 1 \quad \Rightarrow \quad k^* \approx \log_2 n .

In plain English: the longest streak you should expect to see in nn flips is roughly log2n\log_2 n, because that's the run length at which "how many places could this length of streak start" and "how rare is any one streak of that length" roughly balance.

Worked example: checking n=100n=100

log2100=ln100ln24.6050.6936.64.\log_2 100 = \frac{\ln 100}{\ln 2} \approx \frac{4.605}{0.693} \approx 6.64 .

The more careful classical result adds a small correction (roughly log2nlog2log2n\log_2 n - \log_2\log_2 n type refinements plus a constant, and simulation confirms an expected longest streak close to 6.6–7 for n=100n=100), landing at around 7. A quick sanity check: for n=1,000n=1{,}000 flips, log210009.97\log_2 1000 \approx 9.97, so the expected longest streak only grows to about 10 — going from 100 to 1,000 flips (10× more data) adds only about 3 to the expected longest streak, because the relationship is logarithmic, not linear.

number of flips n n=100, streak≈7 n=1000, streak≈10
Expected longest streak grows like log₂n — a slow, flattening curve, not a straight line, so 10× more flips buys only a few extra expected streak length.

Why this matters beyond the puzzle

This is the exact reasoning that should make you skeptical of "wow, that's an amazing streak" claims without context. A trader who's had 7 winning days in a row out of the last 100 trading days isn't necessarily unusually skilled that stretch — a run of that length is close to what you'd expect to see somewhere in 100 independent fair-coin-like outcomes, purely from chance. The right question is never "is this streak long," it's "is this streak longer than log2n\log_2 n would predict by chance alone," which is a much higher bar than most gut checks apply.

The expected longest run of heads in nn fair coin flips scales as klog2nk^* \approx \log_2 n, not as some small constant — because the number of places a streak could start grows with nn even though any one streak's probability shrinks exponentially in its length, and those two effects balance out logarithmically. For n=100n=100, expect a longest streak around 7; for n=1,000n=1{,}000, around 10.

The classic mistake is evaluating "is 7 heads in a row surprising" using the probability of that one run (1/1281/128) instead of the probability of the longest run in the whole sequence reaching 7, which is a completely different (and much larger) probability. Any streak question about "longest run somewhere in nn trials" needs the log2n\log_2 n scaling argument, not a single-run probability.

Related concepts

Practice in interviews

Further reading

  • Schilling, The Longest Run of Heads (1990)
ShareTwitterLinkedIn