How many normal distribution random numbers' sum exceeds $r$? There is a random number generator that obeys the standard normal distribution $X \sim N(\mu,\sigma^2)$, and then calculates the sum of the numbers generated until the sum is greater than $r$. 
Specifically, it means to generate a random number, and then stop if it exceeds $r$, otherwise generate another random number. Sum all generated random numbers, stop if exceeds $r$, otherwise continue
How to find the expectation of the stop time $\mathbb{E}_r[X]$.
 A: I have an iterated solution:
If $Z=X+X$ then $Z\sim N(\mu + \mu, \sigma^2+\sigma^2)$. For $Z_n=\sum_{k=1}^n X$ we have $Z_n\sim N(n\times \mu,n\times \sigma^2)$.
$P(X>r)=P_1(Z_1>r)= 1-\Phi\left({{r-\mu}\over{\sigma}}\right)=Q\left({{r-\mu}\over{\sigma}}\right)$ and for $n$:
$$P_n(Z_n>r) = Q\left({{r-n\times\mu}\over{\sqrt n\times\sigma}}\right)\times\left(1-\sum_{k=1}^{n-1}P_{k}\right)$$ or $$P_n(Z_n>r) = \left(1-\Phi\left({{r-n\times\mu}\over{\sqrt n\times\sigma}}\right)\right)\times\prod_{k=1}^{n-1}\Phi\left({r-k\times\mu}\over{\sqrt k\times\sigma}\right)$$
$E_r[X]=\sum_{n=1}^\infty n\times P_n$
A: Let $N$ be the number of generations needed. We need to find $E_r[N]$. It is natural to assume that $X_i$ are independent since they represent random number generations. Let $X_i$ be the output of the $i$th generation and $S_i=X_1+\cdots+X_i$. Then, $X_i\sim N(\mu,\sigma^2)$ and $S_i\sim N(i\mu,i\sigma^2)$. Let define the indicator random variable
$Y_i=1$ if $S_1\leq r,\ldots,S_i\leq r$
$Y_i=0$ otherwise.
Then, $N=1+\sum_{i=1}^{\infty}Y_i$. Since $Y_i$ are nonnegative,
$E[N]=1+\sum_{i=1}^{\infty}E[Y_i]=1+\sum_{i=1}^{\infty}P\{Y_i=1\}=1+\sum_{i=1}^{\infty}P\{S_1\leq r,\ldots,S_i\leq r\}$
$=1+\sum_{i=1}^{\infty}\int_{-\infty}^r\int_{-\infty}^{r-x_1}\cdots\int_{-\infty}^{r-x_1-\cdots-x_{i-1}}f(x_1)f(x_2)\cdots f(x_i)dx_idx_{i-1}\cdots dx_1$
where $f(x)$ is the probability  density function of $N(\mu,\sigma^2)$.
