Gambling puzzle and unintuitive results in probability Suppose I can pay \$100 to play a game where I repeatedly flip a coin until it lands on tails. Then I tally the number of coin flips, call this number $n$, and I receive a payout of $2^n$ dollars.
Intuitively, I should not play this game. It is clear I will, on average, make 2 flips before the coin lands on tails. Thus I will lose about \$98.
However, I also examine the PMF of our random variable $N$, the number of heads I receive. I notice that
$$P(N=n)=\frac1{2^n}$$
and, with $M=2^N$, my expected payout is therefore
$$\mathbb EM=\sum_{n\geq0}2^n\frac1{2^n}=\sum_{n\geq0}1\to\infty$$
so it looks like I should play this game.
So which is it?
 A: In general $\mathsf E(g(N)) \neq g(\mathsf E(N))$ so you can not simply say that since $E(N)=2$ your expected win is $2^{\mathsf E(N)}-100= -96$.  It doesn't follow.
It's the second case, where the expectated payout is indefinite because the series does not converge.
$$-100+\sum_{n=1}^\infty 2^n P(N=n) = -100+\sum_{n=1}^\infty 1$$
Whether you should play the game or not then can not be decided by the expectation.
Consider instead the probability that you have non-positive winnings. $$\mathsf P(2^N\leq 100) = \mathsf P(N\leq \log_2(100)) = 1-{\left(\tfrac 1 2\right)}^{\log_2( 100 )} =\tfrac{99}{100}$$
So there is a $99\%$ chance that you will lose out.
A: What's missing is that the actual price a rational person would pay to play the game is probably based on their utility of the payoff - when you have 1,000,000 from the game, an extra 10 just isn't worth as much to you as the first 10. An appropriate utility function would cause the sum to converge... One of the Bernoulli brothers suggested a logarithmic utility for example (see the Wikipedia entry for St Petersburg Paradox) as one of the comments mentions). So as with any game, it might make sense to play if the price is right, (but unlike a financial derivative and replication price this will purely be a utility function generated expectation price, so not in some sense as 'fair' as a replication price where you can reproduce the payoff).
