You're right. It seems counter-intuitive to me that flipping three heads in a row (a 1-in-8 shot) takes an expected 14 flips to happen, but it does.
Because the average length of a round which ends when we either flip a tail or get 3 heads:
T : half the time
HT : 1/4 the time
HHT : 1/8 the time
HHH : 1/8 the time
is 1*1/2 + 2*1/4 + 3*1/8 + 3*1/8 = 1.75 tosses - so the expectation is that it takes 1.75*8 = 14 flips.
Tricky one, that. Toss a coin one million times and see how many times you get three heads in a row, right? Not a geometrically distributed random anymore, since the round end is either throwing a tail
or or getting three heads in a row.
I'm not sure of your method but you do have the correct answer. In general, the number of coin tosses it takes on average to get n heads in a row is given by:
(p^(-n) - 1)/(1 - p), where p = 0.5 and n = the number of heads in a row
Heads in a row Expect. no. tosses
1 2
2 6
3 14
4 30
5 62
6 126
7 254
8 510
9 1022
10 2046
11 4094
12 8190
13 16382
14 32766
15 65534
16 131070
17 262142
18 524286
19 1048574
20 2097150
Try this against your method and see if you're right in a few more cases. I'm not saying you're wrong, just that I don't follow how you got your result.
There's a very nice derivation of this (and of a more general solution where the probability of a head or tail varies with each toss) using Markov chains
here.
Thanks for persevering with me!
It was fun and I got to learn some new things. Plus you also persevered - I could have been wrong.