Hi Zak,

I don't know how to compute the probability you seek exactly, but I think I can give a pretty good approximation.

To generalize the problem, let's suppose you have a possibly biased coin which comes up tails with probability p and heads with probability q, where p+q = 1. You flip the coin N times and look for a run of R or more successive tails. We would like to know the probability that at least one such run occurs. The "at least one" part is my interpretation of your problem statement; you didn't say that, but I'm guessing that's what you mean.

As I said, I haven't come up with a reasonable way to compute the exact probability of having at least one run of length R, but think I can solve a closely associated problem which can be used to obtain an approximate answer.

Let be the expected number of runs of R or more successive tails. It can be shown that

.

That is an exact result, not an approximation. (I derived this formula from scratch, but I suppose it must be a well-known result.) So in your case, for example, we have N = 1000, R = 20, p = 0.3 and q = 0.7, so .

Now comes the approximation. Let's suppose the number of runs, say X, has a Poisson distribution with mean . It doesn't, but for small values of it should be pretty close. Then

.

For small values of this value can be hard to compute precisely, but we can use another approximation:

(approximately),

so the answer to your question is (once again, approximately) .