I have a Poisson process with parameter $\lambda$. I stop if $k$ events happen during the last unit of time. What is the expected time until I stop?
For example, I get an email on average every 30 minutes, how often (= how long do I have to wait in expectation) does it happen that at least 5 email come within 5 minutes long window?
Let $\{N(t):t\geqslant0\}$ be a Poisson process with rate $\lambda >0$. Let $k>0$ be a positive integer and $T>0$ a positive time. Let $\tau=\inf\{t>T: N(t) - N(t-T) = k\}$. Then $$ \mathbb P(\tau>T) = \int_T^\infty T*e^{-\lambda T} \frac{(\lambda T)^k}{k!}\ \mathsf d T = \frac{\Gamma[k+2, \lambda T]}{\lambda ^2k!} = \frac{\int_{\lambda T}^\infty t^{k+1}e^{-t}\ \mathsf dt}{\lambda^2k!}, $$ so $$ \mathbb E[\tau] = \int_0^\infty \mathbb P(\tau>T)\ \mathsf dT = \frac1{\lambda^2 k!}\int_0^\infty\int_{\lambda T}^\infty t^{k+2}e^{-t}\ \mathsf dt = \frac1{\lambda^3}(k+3)(k+2)(k+1).$$