Farmer Felix has just had a bountiful harvest with 1 ton of rice, and now he wants to sell all of it. Before getting his rice to the market, his rice needs to go through inspection. Unfortunately, the inspector is a greedy tyrant, and he wants a part of Felix's harvest. The inspector's price is as follow:
- The first inspection costs all the rice.
- If Felix gives the inspector x ton of rice, then the next inspection costs x less.
For example, if the inspector is given 0.2, 0.3, 0.5 ton portions in that order, then finally the total amount of rice gets to the market is: $$0.2\times0 + 0.3\times0.2 + 0.5\times(0.2 + 0.3) = 0.31$$ What is the maximum amount of rice Felix can get to the market (given that the inspector doesn't mind even when he's requested to inspect infinite times)?
If Felix takes rice to the inspector $n$ times with $a_i$ tons of rice at $i$-th step, then the rice that goes to the market is given by the following formula:$$ x = \sum_{i=1}^n a_i\cdot \big(\sum_{j=1}^{i-1} a_j\big)=\sum_{i=1}^n\sum_{j=1}^{i-1}a_i\cdot a_j = \frac{(a_1+a_2+\dots+a_n)^2-a_1^2-a_2^2-\dots-a_n^2}{2}=\frac{1-\sum a_i^2}{2}. $$ The last equality holds since $\sum a_i=1$. By picking $n$ to be arbitrarily large and $a_i$ to be arbitrarily small, you can see that the amount of rice taken to the market can be made arbitrarily close to $0.5$ tons. Also by the formula you can see that there is no way to take more than $0.5$ tons to the market.
In your example, you made a mistake since $0.2\times 0+0.3\times 0.2+0.5\times (0.2+0.3)=0.31$, not $0.51$.
Edit: The $0.5$ bound also works if you allow Felix to go to the inspector infinitely many times. Say $\sum_{i=1}^\infty a_i=1$ (with, of course, $a_i>0$). Then $\sum_{i=1}^\infty a_i^2$ is also convergent, thus the above formula still holds.