20180404, 17:42  #1 
1976 Toyota Corona years forever!
"Wayne"
Nov 2006
Saskatchewan, Canada
29×157 Posts 
N Heads in a Row
Given a coin that lands heads with probability 0 < p < 1, what is the expected number of flips needed to get N heads in a row?
Solve with p = 0.73 and N = 20. Then can someone give a general method / formula based only on p and N? Thanks 
20180404, 18:12  #2 
Dec 2012
The Netherlands
1,621 Posts 
It's the negative binomial distribution (with parameters N and p).

20180404, 20:01  #3 
1976 Toyota Corona years forever!
"Wayne"
Nov 2006
Saskatchewan, Canada
29·157 Posts 
Pardon my ignorance but ...
maybe I'm not understanding this right, but it looks like negative binomial distribution is used to determine, for instance, the expected number of tails before a predetermined number of heads, but not necessarily in order 
20180404, 21:34  #4 
Dec 2012
The Netherlands
1,621 Posts 
I think I misunderstood you!
In that case, you can work it out from first principles. Fix a positive integer \(k\geq N\). How many ways are there of throwing \(kN\) times without getting \(N\) heads in a row? What is the probability of each of those possibilities followed by \(N\) consecutive heads? Last fiddled with by Nick on 20180404 at 21:34 Reason: Fixed typo 
20180404, 22:07  #5  
"William"
May 2003
New Haven
3×787 Posts 
Quote:
I'd try an inductive approach on the number of heads. To get one head in a row, the first toss is a head with probability p or a tail with probability (1p). If heads, you are done. If tails, you need the to start over. So X1 = p*1 + (1p)*(X1+1) X1 = 1/p For k in a row, you need k1 in a row, then one more toss either finishes it or starts it over. Xk = p*(X(k1)+1) + (1p)(Xk+X(k1)+1) Xk = X(k1)/p + 1/p The logic of the last equation is conditioned on the results of the flip after first achieving k1 heads. Check that arithmetic  I fixed several errors before posting and might still have some left  but the logic is solid. 

20180404, 23:37  #6 
"Forget I exist"
Jul 2009
Dumbassville
20C0_{16} Posts 
Take 1(1p)ⁿ to be the probability of getting heads n times ? Factor in how far you've advanced and find where it hits 50% ?

20180405, 04:53  #7 
"William"
May 2003
New Haven
100100111001_{2} Posts 
Oops  this is Homework Help. I had fun working out the inductive equations and their general solution, but I suppose I shouldn't post all that here. So I stand by the previous suggestion that N+1 heads in a row takes N heads in a row plus one more, and then you may be done or you may need to start over. To check your work, I get 2001.6 for p = 0.73 and N = 20.
