TITLE: $e$ popping up in topic I'm unfamiliar with
QUESTION [13 upvotes]: I programmed up a little algorithm that goes like this:

Fix two positive, real numbers, call them $\alpha$ and $\beta$.
Generate a new, random, real number, $x \in [0,1]$ 
Set $\alpha$ = $x\alpha\beta$,
Repeat 2 and 3 until $\alpha$ is equal to the smallest float supported (I'll just call this 0), or $\alpha$ is equal to the largest float supported (I'll call this $\infty$).

Initially I thought this would turn up nonsense, or only occasionally go to 0 or infinity.
But after experimenting a lot with values of $\beta$, I found a fascinating result:
If $\beta \in (0,e)$, $\alpha$ always goes to $0$.
If $\beta=e$, $\alpha$ goes to $0$ about 50% of the time, and to $\infty$ about 50% of the time.
If $\beta \in (e,\infty)$, $\alpha$ always goes to $\infty$.
Now these are all results based on running the above algorithm about 10,000 times, so maybe I'm in the wrong to put 'always', but certainly most of the time these results hold.
This was surprising to me! I'm not well versed in randomness, or computational mathematics, or probability so I can't really fathom why $e$ would pop up so prominently in this context. Can anyone point me towards the subject I need to examine to understand this result?
(Apologies if this post is mistagged, as I said, I'm not experienced with the subjects this post related to)

REPLY [4 votes]: You have $\alpha_{i+1}=\alpha_{i} X_{i+1}$, where $X_i\sim U(0,\beta)$; so $\alpha_{n}=\alpha_{0}\prod_{i=1}^{n}X_{i}$.  The infinite product (and hence $\alpha_n$) diverges to $+\infty$ if its logarithm,
$$
\sum_{i=1}^{n}\log X_i,
$$
does, and by the law of large numbers this occurs almost surely if $E[\log X_i]>0$.  Now,
$$
E[\log X_i]=\frac{1}{\beta}\int_{0}^{\beta}\log x dx=\log(\beta)-1=\log(\beta/e),
$$
which is positive when $\beta>e$.  Similarly, the product diverges to $0$ if its logarithm diverges to $-\infty$, which occurs almost surely if $\beta < e$.  Finally, if $\beta=e$ exactly, you have an unbiased one-dimensional random walk, which implies that $\alpha_n$ neither converges nor diverges: with probability $1$, it crosses $1$ (that is, goes from larger than $1$ to smaller, or vice-versa) infinitely many times.