User blog:P進大好きbot/Large Number in Probability Theory

I define a random process which always returns a finite number but whose expected value is infinity.


 * 1) Set \(i = 1\).
 * 2) Flip a coin.
 * 3) If you win the flip, then replace \(i\) by \(i * 2\). Go to 2.
 * 4) If you lose the flip, then return \(i\).

The expected value can be computed in the following way: \begin{eqnarray*} E = \sum_{n = 0}^{\infty} \left( \frac{1}{2} \right)^n \cdot 2^n =\sum_{n = 0}^{\infty} 1 = \infty \end{eqnarray*}

Here, I assume that you have infinitely long lifetime so that you can flip a coin arbitrary many times. Then this random process is "expected" to yield an arbitrary large number by the computation of \(E\).

By the way, I tried to write a source code in c++ first, but I knew no library which enables you to flip a coin. If you use a usual library for random numbers, then you need to take care of the initialisation. For example, if you simply use the time, then the resulting random value can be apptoximately cyclic because a computer costs approximately the same seconds to execute a single loop from 2 to 3.