standarddeviationcalculator.net

Updated Free · runs in your browser

Statistics

Coin toss streak calculator

How likely is it to see 4, 7 or 10 heads in a row somewhere in a series of coin tosses? Enter the number of tosses and the streak length to get the exact probability and the length of the longest run you should expect.

0.5 for a fair coin.

P(4 or more heads in a row in 20 tosses) 0.478 (47.8%, about 1 in 2.09)
No such streak0.52198
Expected longest run3.729
Most likely longest run3
Expected number of 4+ streaks0.5625
00.050.10.150.20.250.3 0123456789101112 longest run probability
P(longest run is at least this long)
Longest runProbability
1 or more1
2 or more0.98311
3 or more0.78703
4 or more0.47802
5 or more0.24987
6 or more0.12232
7 or more0.058182
Show the working, step by step
  1. Work out the chance of avoiding a streak of 4. Build the sequence toss by toss and track the run the sequence currently ends in; any sequence whose run reaches 4 is thrown away.

    aH(m) = Σj=1…3 aT(m − j) × pj, aT(m) = Σj≥1 aH(m − j) × qj p = 0.5, q = 0.5

  2. After all tosses, the probability of never reaching the streak is the sum of the two endings:

    P(no streak) = aH(20) + aT(20) = 0.521981

  3. The streak happens with the complementary probability:

    P(streak) = 1 − 0.521981 = 0.478019

  4. Repeating this for every k gives the distribution of the longest run, and its mean:

    E[longest run] = Σk≥1 P(longest ≥ k) = 3.7292

aH(m) is the probability that the first m tosses contain no forbidden streak and toss m is heads; aT(m) is the same ending in tails. This is exact, not a simulation or an approximation.

How the probability is worked out

There is no one-line formula for the chance of a streak, because streaks can start anywhere and overlap. The calculator counts the other way round: the probability of getting through all n tosses without a streak of k. It builds the sequence one toss at a time and tracks how the sequence currently ends. Write aH(m) for the probability that the first m tosses contain no forbidden streak and end in heads, and aT(m) for the same ending in tails. For a streak of heads:

aH(m) = Σj=1…k−1 aT(m − j) pʲ aT(m) = Σj≥1 aH(m − j) qʲ P(streak) = 1 − aH(n) − aT(n)

Each sequence is a run of tails followed by a run of heads (shorter than k), and so on; p is the chance of heads and q = 1 − p. For “either side”, the tails runs are limited to k − 1 as well. The result is exact, and it agrees with listing all 2ⁿ sequences by hand when n is small.

A worked example

The default asks: in 20 tosses of a fair coin, what is the chance of 4 or more heads in a row? The answer is 0.478, a little under a half. Of the 2²⁰ = 1,048,576 possible sequences, about 52.2% have no run of 4 heads.

The same calculation, repeated for every k, gives the distribution of the longest run of heads in 20 tosses. Its most likely value is 3 and its average is 3.73. The expected number of separate runs of 4 or more heads is

(½)⁴ + (20 − 4) × ½ × (½)⁴ = 0.0625 + 0.5 = 0.5625

That first term counts a streak at the very start; the second counts a streak that begins right after a tail. Because some sequences contain two such runs, the expected count (0.5625) is higher than the probability of at least one (0.478).

Reading the result

Streaks are more common than intuition suggests. In 100 fair tosses, 5 heads in a row turns up with probability 0.81, and the longest run of the same face averages about 7. That is why a sequence someone invents to “look random” tends to switch sides too often. For a biased coin, change P(heads): with p = 0.6 the chance of 4 heads in a row in 20 tosses rises to 0.719.

Common mistakes

  • Using (½)ᵏ, which is the chance for one fixed block of tosses, not anywhere in the sequence.
  • Multiplying (½)ᵏ by the number of starting points, which double-counts overlapping streaks and can give a “probability” above 1.
  • Confusing “heads” with “either side”. A run of either face is much more likely.
  • Reading a long streak as evidence that the next toss will break it, or continue it. The next toss is still 50–50.
Coin toss streak calculator: the worked example on this page, with its result and chart
Coin toss streak calculator: the worked example above, at a glance.

Common questions

Why not just use (½)ᵏ for a streak of k heads?

(½)ᵏ is the chance that one particular block of k tosses is all heads. A streak can start at many places in a long sequence, and those places overlap, so you cannot multiply (½)ᵏ by the number of starting points either. For 4 heads in 20 tosses that shortcut gives 17 × 1/16 = 1.06, which is impossible. The exact answer is 0.478.

What is the chance of 3 heads in a row in 10 tosses?

520 ÷ 1024 = 0.5078. Of the 1,024 possible sequences, 504 avoid three heads in a row (a tribonacci number), so the other 520 contain the streak.

What does “either side” mean?

It counts a streak of k identical faces, heads or tails. It is roughly twice as likely as a streak of heads alone when the probability is small, and more likely still to show up in a long sequence. In 20 fair tosses a run of 4 of either face has probability 0.768, against 0.478 for 4 heads.

What is the expected longest run in 100 tosses?

About 6.0 for heads alone and about 7.0 for either face. A useful rule of thumb is that the longest run of heads in n fair tosses is close to log₂(n) − 0.67, and it grows slowly: doubling the tosses adds only about one to the longest run.

Does a long streak mean the coin is biased?

Rarely. Streaks that feel extraordinary are common in long sequences. A 10-heads streak in 1,000 fair tosses has probability 0.385. Test for bias with the count of heads (a binomial test), not with the length of the longest run.