I have the following GRE question that I have no idea how to solve.
Let $\left \lfloor x \right \rfloor$ denote the greatest integer not exceeding $x$. Evaluate $\int_0^\infty \left \lfloor x \right \rfloor e^{-x} \,\mathrm{d}x$.
The answer says it should be $\frac{1}{e-1}$, and a hint that they give is
$$ \int\limits_0^\infty \left \lfloor x \right \rfloor e^{-x} \,\mathrm{d}x = \sum_{n=1}^\infty \int\limits_n^{n+1} ne^{-x} \,\mathrm{d}x\,. $$
I don't really see how we go from the integral to the summation.