Probability brain teaser with infinite loop I found this problem and I've been stuck on how to solve it.


  A miner is trapped in a mine containing 3 doors. The first door leads to a tunnel that will take him to safety after 3 hours of travel. The second door leads to a tunnel that will return him to the mine after 5 hours of travel. The third door leads to a tunnel that will return him to the mine after 7 hours. If we assume that the miner is at all times equally likely to choose any one of doors, what is the expected length of time until he reaches safety?


The fact that the miner could be stuck in an infinite loop has confused me.
Any help is greatly appreciated.
Let $T$ be the time spent in the mine. Conditioning on the first door the miner chooses, we get
$$ \mathbb{E}[T]=\frac{1}{3}\cdot3+\frac{1}{3}(5+\mathbb{E}[T])+\frac{1}{3}(7+\mathbb{E}[T])$$
so
$$ \mathbb{E}[T]=5+\frac{2}{3}\mathbb{E}[T].$$
If $\mathbb{E}[T]$ is finite, then we can conclude that $\mathbb{E}[T]=15$.

To see that $\mathbb{E}[T]$ is finite, let $X$ be the number of times the miner chooses a door. Then $ \mathbb{P}(X\geq n)=(\frac{2}{3})^{n-1}$ for $n=1,2,3,\dots$, hence
$$ \mathbb{E}[X]=\sum_{n=1}^{\infty}\mathbb{P}(X\geq n)=\sum_{n=1}^{\infty}\Big(\frac{2}{3}\Big)^{n-1}&lt;\infty$$
And since $T\leq 7(X-1)+3$, we see that $\mathbb{E}[T]&lt;\infty$ as well.
A probability tree reveals that the miner can expect to spend 9 hours to reach safety. Suppose he chooses Door 7, with probability 1/3; he returns to the start and chooses Door 5 with p = 1/2; he returns and chooses Door 3 with p = 1. Then his path would take take 7 + 5 + 3 = 15 hours with p = (1/3)(1/2)(1) = 1/6. The other possible paths are 7 + 3 = 10, p = 1/6; 5 + 7 + 3 = 15, p = 1/6; 5 + 3 = 8, p = 1/6; and 3, p = 2/6. If T is the rv "time to exit", then its expectation is E(T) = 15*(1/6) + 10*(1/6) + 15*(1/6) + 8*(1/6) + 3*(2/6) = 54/6 = 9 hours.