I threw a coin
n times, and never got three tails in a row. I calculated the odds of this event, and found out they were just about even; 50%-50%. How many times did I throw the coin?
A second question: what were the chances of having not gotten three heads in a row either?
Let f(n) be the number of sequences of heads and tails, of length n, in which three consecutive tails do not appear.
The total number of possible sequences from n coin tosses is 2n.
So the probability that no three consecutive tails occur in n coin tosses is f(n) / 2n.
By enumeration, f(1) = 2, since we have {H, T}, f(2) = 3, from {HH, HT, TH}, and f(3) = 7, from {HHH, HHT, HTH, HTT, THH, THT, TTH}.
We then derive a recurrence relation for f(n), as follows.
A sequence of n > 3 coin tosses has no three consecutive tails if, and only if:
- It begins with a head, and is followed by n-1 tosses with no three consecutive tails; or
- It begins with a tail, then a head, and is followed by n-2 tosses with no three consecutive tails;
- It begins with two tails, then a head, and followed by n-3 tosses with no three consecutive tails.
These three possibilities are mutually exclusive, so we have f(n) = f(n-1) + f(n-2) + f(n-3).
This is simply the Tribonacci sequence, shifted forward a few terms.
Calculating further terms, we find that f(9) = 274, f(10) = 504, and f(11) = 927, yielding respective probabilities of 0.53515625, 0.4921875, and 0.45263671875.
Therefore you threw the coin 10 times.