In a sequence of $n$ trials, I expect the probability of successful trials to be $p$. That is, if I play a game $n = 100$ times, I expect to win 60% ($p = 0.6$) of the time. Additionally, I have some probability $q$ of success for each individual trial.
What is the probability that I will NEVER lose $k$ times in a row? This doesn't necessarily need to be an exact solution (approximations are welcome), but I would like to understand the general thought process.
I've seen solutions to similar questions about the probability of $k$ failures in $n$ trials, but those solutions usually dealt with an arbitrary number of failures. Here I have some expectations of the number of failures I'll end up with, and I am interested in knowing how often the failures will cluster.
For $k = 2$ an exact answer seems pretty easy, but if $k = 5$ it seems much more involved.
Suppose $Q_k(n)$ is the probability that you never have $k$ consecutive failures in $n$ attempts. Then it seems simple to say:
With $n \gt k \gt 0$ you need to consider whether you had $k$ or more consecutive failures in $n-1$ attempts, or whether you had fewer than $k$ failures in the first $n-k-1$ attempts followed by a success and then $k$ failures, so
a fairly simple recursion which you could turn into a generating function if you wished, perhaps (not checked) of the form of the coefficient of $x^n$ in the expansion of $\frac{1- (1-p)^k\, x^k}{1-x+ p\,(1-p)^k\, x^{k+1}}$. I doubt there is a simple closed form
As far as I can tell, $Q_5(100) = \frac{1365490018934343224860980320752463795438133087530483620534582052877}{2524354896707237777317531408904915934954260592348873615264892578125}\approx 0.5409$ when $p=0.6$ and you are welcome to simulate this to check