Disclaimer: I want solution verification unless a technique very similar to mine has been posted elsewhere, please do NOT mark this as a duplicate. This problem has been solved before on this website, however, I felt the need to craft my own solution, but have encountered a little roadblock.
The Problem
What is the expected amount of numbers -- such that each number is randomly selected from a uniform distribution over $(0, 1)$ -- to first exceed a sum of 1 when added together?
My approach
Let $X$ be a random variable that counts the number of numbers until we achieve a sum $\geq 1$. We know that $$ P(X = x) =\ P(sum\ of\ first\ x - 1\ items< 1)\cdot P(x^{th}\ number\ pushes\ the\ sum\ to\ \geq 1) \\$$ $$\ P(sum\ of\ first\ x - 1\ items< 1) = 1 - P(sum\ of\ first\ x - 1\ items\geq 1) \\$$ $$P(sum\ of\ first\ x - 1\ items\geq 1) = 1-\biggl (1-\frac{1}{x-1} \biggr)^{x-1} $$ Note that $P(sum\ of\ first\ x - 1\ items\geq 1) \neq P(X = x- 1)$ because the sum may exceed 1 because of any number in the set $\{n_1, n_2, ..., n_{x-1}\}$.
Also, $\biggl (1-\frac{1}{x-1} \biggr)$ represents the chance that the $i^{th}$ item is larger than or equal to the average of the sum $[letting\ \overline n = average\ of\ any\ x-1\ numbers\ that\ sum\ upto\ exactly\ 1]$:
$$\\ (n_1\ +\ n_2\ +\ ...\ +\ n_{x-1} < 1)\ \leftrightarrow\ \lnot(n_1\geq\overline n\ \land\ ...\ \land\ n_{x-1} \geq\overline n) \\ $$
$$P(n_i \geq\overline n) = \ 1-\overline n ,\ as\ n_i\ comes\ from\ U(0, 1)\ ;1\leq i \leq x-1 \\$$
$$\overline n,\ by\ our\ definition,\ = \frac{1}{total\ number\ of\ numbers} = \frac{1}{x-1} \\$$
Repeatedly iterating this probability for all $i$ (for all items in the set that we have been counting, except the last one), we get $\biggl (1-\frac{1}{x-1} \biggr)^{x-1}$. Taking then complement gives us the expression for $P(sum\ of\ first\ x - 1\ items< 1)$. $$ \\ $$
A similar method follows for $P(x^{th}\ number\ pushes\ the\ sum\ to\ \geq 1)$, as the $x^{th}$ item or $n_x$ must be greater than $\overline n$ to exceed a sum of 1 (as we previously derived), yields:
$$ P(x^{th}\ number\ pushes\ the\ sum\ to\ \geq 1) = 1 - \frac{1}{x-1} \\$$
Overall, we get: $$\\ P(X = x) = \Biggl( 1-\biggl (1-\frac{1}{x-1} \biggr)^{x-1} \Biggr) \cdot \biggl( 1 - \frac{1}{x-1} \biggr) \\ $$
$$E[X] = \sum_{x} xP(X=x)\ \ \ for\ \ \ x>1\\$$
The issue
Upon computing $E[X]$ using a calculator, $E[X]$ diverges. This does not make sense as there is a trivially small chance of getting a huge sequence of small numbers in the range $(0, 1)$ and NOT getting a single number high enough to exceed a sum of 1. Not sure where I am wrong; would appreciate any help.
Say $x=2$ Your formula yields $1-\left(1-\frac 1{2-1}\right)^{2-1}=1$, yes? But this is clearly false.
– lulu Aug 25 '20 at 21:34