I've been grappling with this one combinatorially, but I'm still not sure I have it, and wanted to see if anyone could provide a nice closed form solution.
Suppose we have a biased coin that lands heads with probability p and tails with probability (1 - p). If we flip the coin x times, what's the probability that there is some run of n consecutive flips in which the coin lands heads m times? (The m heads need not be consecutive, and obviously x ≥ n ≥ m.)
Sorry if this has already been asked - a brief search didn't turn anything up.