Coin Flip Streak Calculator - Longest Heads Run Probability
Use the coin flip streak calculator for the longest heads run probability. Get exact, at-least, at-most, and expected run length for fair or biased coins.
Coin Flip Streak Calculator
Results
What Is a Coin Flip Streak?
The coin flip streak calculator works out the probability of a coin flip streak, a run of consecutive same-side outcomes (most often heads) in a sequence of independent coin tosses. It returns the chance the longest run of heads in n flips equals exactly k, stays at most k, or reaches at least k, plus the expected run length for fair or biased coins. Use it whenever the question is about consecutive heads, not the total head count.
- • Homework and textbook problems: Solve streak questions like 'what is the chance of 3 heads in a row in 10 flips' without enumerating 1024 outcomes by hand.
- • Sports and game streak analysis: Estimate the chance of winning streaks of various lengths in series-style contests, play-off runs, or coin-toss tiebreakers.
- • Randomness testing: Compare an observed streak length to the distribution of plausible streak lengths to check whether a coin or RNG looks fair.
The streak question looks similar to a head count question but it cares about order, not totals. HHHTH has 4 heads in 5 flips with a longest run of 3, while HTTHH has 3 heads with a longest run of 2, even though the second sequence has fewer heads. The streak distribution depends on runs of consecutive heads, so it needs a different formula than a head count.
For questions that only care about the total number of heads in n flips, the coin flip probability calculator is the closer tool, since the streak question needs a different model that depends on run order.
How the Streak Probability Recurrence Works
The coin flip streak calculator applies a recursive probability formula for the longest run of heads. For a fair coin the same recurrence reduces to a (k+1)-step Fibonacci sequence; a biased coin weights each initial run by powers of p and 1-p so the same shape works for any per-flip heads probability.
- n: Number of independent coin flips in the experiment. Integer from 1 up to 1000.
- k: Streak length to evaluate. 0 means no heads at all; values above n collapse to 0 or 1.
- p: Probability of heads on each flip. 0.5 is a fair coin; the calculator accepts any value from 0 to 1.
- g(k, n): Probability the longest heads run is at most k. Computed by the recurrence with memoization.
The at-least probability is the complement of the at-most probability for k - 1, so the calculator reads P(L ≥ k) = 1 - g(k - 1, n) directly. The exact probability is the difference P(L = k) = g(k, n) - g(k - 1, n), so each row reuses the same g values.
10 fair flips, longest run of exactly 3 heads
n = 10, k = 3, p = 0.5
g(2, 10) = 504/1024, g(3, 10) = 773/1024, so P(L = 3) = (773 - 504) / 1024 = 269/1024.
P(L = 3) ≈ 0.2627, or about 26.27 percent.
About one in four runs of 10 fair flips produces a longest heads run of exactly 3. About half (50.78 percent) reach 3 or more and three quarters (75.49 percent) keep the longest run at or below 3.
According to Schilling, The Longest Run of Heads (College Mathematics Journal, 1990), Schilling's College Mathematics Journal paper states that the probability that the longest run of heads in n fair coin flips has length at most k is f(k, n) / 2^n, where f(k, n) follows a (k+1)-step Fibonacci recurrence with f(k, j) = 2^j for j = 0, 1, ..., k.
The recurrence is built from the same per-flip head probability p that drives a binomial distribution, and the binomial distribution calculator is the right tool when the question is about total head counts rather than runs.
Key Concepts Behind the Streak Distribution
Four ideas carry the meaning behind every probability the calculator reports. Understanding them turns the numbers into a usable answer about coin flip streaks.
Longest run vs number of heads
The longest run cares about the order of outcomes, while a head count only adds them up. Two sequences with the same number of heads can sit in different longest-run buckets, which is why the streak distribution is not the binomial distribution.
Recursive at-most probability
g(k, n) = sum from j=0 to k of p^j · (1 - p) · g(k, n - j - 1) splits the question by the length of the first heads run. The first run ends with a tail once n > k, and the remaining flips are an independent copy of the same problem.
(k+1)-step Fibonacci for fair coins
When p = 0.5 the recurrence collapses to a (k+1)-step Fibonacci. k = 1 is Fibonacci, k = 2 is Tribonacci, k = 3 is Tetranacci, with f(k, 0) = 1 and f(k, j) = 2^j for j = 0, ..., k.
Expected longest run from the survival sum
E[L] = sum from i=1 to n of P(L ≥ i), equivalently sum from i=0 to n-1 of (1 - g(i, n)). The expected longest run is roughly log_2(n); doubling n adds about 1.
For k = 1 the formula reduces to Fibonacci, and f(1, 10) = 144 means only 144 of 1024 length-10 sequences avoid adjacent heads. For k = 2 it is Tribonacci, with f(2, 10) = 504 sequences whose longest run is at most 2.
According to Wolfram MathWorld, Run (Wolfram Research), a run (streak) is a maximal subsequence of identical outcomes in a Bernoulli sequence, and the longest-run distribution follows the Schilling recurrence for fair coins and a similar weighted recurrence for biased coins.
When the question flips to 'how many flips until the first run of k heads' rather than 'how long is the longest run in n flips', the geometric distribution calculator returns the matching waiting-time probability.
How to Use This Calculator
Set the three parameters to match your experiment, then read the six output rows. The defaults reproduce the standard homework case of 10 fair flips and a streak of 3 heads.
- 1 Enter the number of flips n: Type the integer number of independent flips. The default 10 covers the standard textbook streak question; raise it to 50 or 100 for sports-streak scenarios.
- 2 Enter the streak length k and bias p: Type the integer length of the heads run (0 = no heads) and set p to 0.5 for a fair coin. For a biased coin, raise p above 0.5 for heads-heavy tokens or lower it for tails-heavy ones.
- 3 Read the exact and cumulative probabilities: Use the exact row for 'longest run equals exactly k'. Use the at-least row for 'reaches k or more' and the at-most row for 'stays at k or below'.
- 4 Check the extremes and the expected run: The all-tails and all-heads rows anchor the distribution as (1 - p)^n and p^n. The E[L] row is the typical longest streak for the chosen n and p.
If you want the chance of a streak of 3 or more heads in 10 fair flips, set n = 10, k = 3, p = 0.5, and read the P(L ≥ k) At Least row. The calculator returns about 50.78 percent, a much higher chance than most people expect for a 3-in-a-row streak; the exact row gives about 26.27 percent.
If the streak question is phrased as a single event probability rather than a run-length distribution, the probability calculator covers that phrasing in a more general form.
Benefits of This Streak Calculator
The coin flip streak calculator collapses exact, at-least, at-most, and expected run outputs into a single form, so a streak question no longer needs several separate tools or hand-rolled code.
- • Exact recurrence-based probabilities: Computes the streak probability directly from the Schilling recurrence, including the (k+1)-step Fibonacci values for fair coins.
- • Three probability styles in one view: Shows exact, at-most, and at-least probabilities side by side, so any phrasing is answered without re-deriving the complement.
- • Expected longest run included: Reports E[L] alongside the probabilities, so the page also answers 'how long a streak should I plan for on average'.
- • Works for fair and biased coins: Accepts any per-flip heads probability p from 0 to 1, so weighted or deliberately unfair flips use the same form.
For one-sided streak questions like 'is 4 heads in a row in 12 flips surprising' the at-least row gives a direct read. For two-sided questions like 'how unusual is a longest run of exactly 1 in 20 flips' the exact row answers without taking a complement by hand.
When the same streak probability needs to be reported as a fraction or ratio instead of a percent, the probability fraction calculator rewrites the value in that format for homework or probability exercises.
Factors That Affect Streak Probability
The numbers from the coin flip streak calculator are only as accurate as the assumption that each flip is independent with the same per-flip heads probability. Real-world factors shift the result away from the modeled distribution.
Coin fairness and per-flip bias p
Real coins are not perfectly fair. Manufacturing imperfections, weight distribution, and landing surface change the effective p. The calculator accepts any p from 0 to 1, so a measured bias can be entered.
Number of flips n
Larger n increases both the expected longest run and the spread of the distribution. The expected value is roughly log_2(n), so n = 10 has E[L] near 3 while n = 1000 has E[L] near 10.
Streak length threshold k
Larger k shrinks the at-least probability roughly like p^k with a combinatorial bonus from the (k+1)-step Fibonacci count. The same k can be common at n = 5 and very rare at n = 50.
- • The recurrence assumes a constant p across all flips. Sequences where p changes mid-experiment need a different model.
- • The cap at n = 1000 keeps results stable; for n in the thousands a normal approximation is often a faster way to read the tail of the distribution.
For large n the streak distribution becomes bell-shaped around its expected value, and a normal approximation with mean E[L] gives a quick read on the tail probabilities. Always report the assumptions: 'P(L ≥ 5) ≈ 25 percent' is only meaningful for independent flips with a fixed p.
According to NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.3.1 Runs, the e-Handbook defines a run as a sequence of consecutive identical outcomes and presents the same recurrence-based probability formulas used to test randomness in coin-flip data.
For n in the hundreds the streak distribution looks bell-shaped, and the z-score calculator can standardize an observed longest-run length to read tail probabilities more quickly.
Frequently Asked Questions
Q: What is a coin flip streak?
A: A coin flip streak is a run of consecutive same-side outcomes in a sequence of coin tosses. When the question is about the longest run of heads in n flips, the streak distribution is the one returned by this calculator, not the simple count of heads.
Q: What is the probability of a streak of at least 3 heads in 10 flips?
A: For 10 fair flips, P(L ≥ 3) is about 50.78 percent. Roughly half of all runs of 10 flips will produce a longest heads run of 3 or more, even though a run of exactly 3 is only about 26.27 percent.
Q: How do you calculate the longest run of heads in coin flips?
A: Use the recurrence P(L ≤ k) = g(k, n), with g(k, n) = 1 for n ≤ k and g(k, n) = sum_{j=0..k} p^j · (1 - p) · g(k, n - j - 1) for n > k. The at-least probability is 1 - g(k - 1, n).
Q: How does a biased coin change streak probability?
A: A biased coin keeps the same (k+1)-step recurrence but weights the first run by p^j · (1 - p) instead of 0.5^{j+1}. Higher p makes long streaks more common, lower p makes them rarer, and the calculator accepts any p from 0 to 1.
Q: What is the expected longest streak of heads?
A: The expected longest run is E[L] = sum_{i=1..n} P(L ≥ i), which is roughly log_2(n) for a fair coin. For n = 10 the expected longest heads run is about 2.80, and for n = 100 it rises to about 5.01.