# How long will it take to get 10 heads in a row flipping coins?

I need a way of solving this problem: It's not math homework, I legitimately want to know and it's bothering me.

So the probability of having a coin land on heads is .5 or 1/2, so it'll land on heads half the time in a perfect world. The probability of a coin landing heads ten times in a row is .0009765625. There are 7,000,000 people on the planet. Each person can flip a coin 17280 times a day. If every person on the planet flips coins until one person gets ten heads in a row, how long will it take to get the 10 heads in a row?

-
+1 for "it's bothering me" –  Inquest Feb 2 '13 at 6:28

If you think that everybody flips simultaneously (presumably that was every 5 seconds, 24 hours a day) we can talk in terms of the number of flips. One of every 1024 will get 10 heads starting from the first flip. So it is almost certain that somebody will get it, and the first will be 45 seconds from the start of the experiment.

-
So what would the formula be if it was likely to take more than 1 day? Say if I was trying to find out how long it would take a person in the same scenario to get 5000 heads in a row? –  Nick Feb 2 '13 at 6:00
@Nick: there is a phase transition from where the probability for one person is much more than 1 in 7E9 to where is is much less than 1 in 7E9. When it is much more, somebody will win on the first try. When it is much less, you will never have two together so you just have 7E9 independent efforts. So for 5000 heads you wait $\frac {2^{5000}}{7\cdot 10^9}\approx 2\cdot 10^{1495}$ trial times, almost forever. –  Ross Millikan Feb 2 '13 at 6:15

We solve a problem that is not the same as yours. Instead, we find the expected number of tosses if a single person is doing the tossing.

It is intuitively clear that the expected number of tosses is finite. The proof is not hard, but we omit it. The argument below is of wide applicability.

We say that we are in state $S_k$ if $10$ heads in a row has not yet occurred, and our last $k$ tosses are heads, but either we have only tossed $k$ times, or the toss before our $k$ heads is a tail.

Let $e_k$ be the expected additional number of tosses until we get $10$ heads in a row, given that we are in state $S_k$.

Then $e_0$ is our required expected waiting time.

Suppose we are in state $S_0$. We toss a coin. If tail, we remain in $S_0$, else we enter $S_1$. Thus

$e_0=1+\frac{1}{2}e_0+\frac{1}{2}e_1$.

Similarly,

$e_1=1+\frac{1}{2}e_0 +\frac{1}{2}e_2$.

In general, for $k\le 8$, we have

$e_k=\frac{1}{2}e_0 +\frac{1}{2}e_{k+1}$.

Finally,

$e_9=1+\frac{1}{2}e_0$.

Ten simple linear equations in ten unknowns. Solve for $e_0$.

-