Problem:
$U_1,U_2,\cdots,U_n$are i.i.d r.v.~$U(0,1)$
$S_n:=U_1+\cdots+U_n;X:=\inf\{n:S_n\geq1\}$
compute $EX$.
I tried constructing a function $f(a)=EX_a$ where $X_a:=\inf\{n:S_n\geq a\}$ and now I aim to find and solve the equation of $f(a)$ and let $a=1$ then I get the value.
First I considered two situations where $U_1\geq a$ and $U_1<a$, respectively. And I constructed another r.v. $\hat{X_a}:=\inf\{n-1:U_2+\cdots+U_n\geq a\}$, so that I have $X_a=1_{\{U_1\geq a\}}+1_{\{U_1<a\}}(1+\hat{X}_{a-U_1}).$ Also, $\hat{X_a}$ and $X_a$ share the same distribution thus they share the same expectation.
Furthermore, $f(a)=EX_a=1+E(1_{\{U_1<a\}}·\hat{X}_{a-U_1})$, and since $1_{\{U_1<a\}}$ and $\hat{X}_{a-U_1}$ are independent from each other I get $$\begin{aligned}f(a)&=1+aE\hat{X}_{a-U_1}\\&=1+aE[E(\hat{X}_{a-U_1}|U_1=x)]\\&=1+aE(E\hat{X}_{a-x})\\&=1+aEf(a-x)\\&=1+a\int_0^af(a-x){\rm d}x\\&=1+a\int_0^af(x){\rm d}x.\end{aligned}$$
So the equation I get is $$f''(a)=af'(a)+2f(a)$$ But the answer indicates that $f(a)=e^a$ and $EX=e$, where did I go wrong?