The probability that you can get N heads in a row would be:
Let <span>p</span> be the probability of flipping a heads. Let <span>x</span> be number of flips needed to achieve <span>h </span>consecutive heads. The solution is <span><span>E(x) = (<span><span>1−<span>p^h) / (</span></span><span><span>p^h</span>(1−p))</span></span></span></span>
This expression may be derived as follows. The probability of being successful immediately is <span><span>p^r.</span></span> However, one might get a tails immediately. In that case, the number of flips needed is <span><span>1+E(x) </span></span>(one flip has been used and we are back to the original position). We might get a heads and then a tails. In this case two flips have been used and we are back to the original position. Continue this up to <span><span>h−1</span></span> heads followed by a tails in which case <span>h</span> flips have been used and we are back to the original position.