GRE question: Evaluate $\int_0^\infty \left \lfloor x \right \rfloor e^{-x} \,\mathrm{d}x$ 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. 
 A: Note that
$$
\int_0^\infty \lfloor x \rfloor e^{-x}dx = 
\int_0^1 \lfloor x \rfloor e^{-x}dx + 
\int_1^2 \lfloor x \rfloor e^{-x}dx + 
\int_2^3 \lfloor x \rfloor e^{-x}dx + \cdots =\\
\sum_{n=0}^\infty \int_{n}^{n+1} \lfloor x \rfloor e^{-x}dx
$$
and from here it should be clear.
A: Probabilistically, this is asking about $\mathbf{E}[\lfloor X\rfloor]$ where $X\sim \mathrm{Exp}(1)$. 
It is well known that if $X\sim \mathrm{Exp}(\lambda)$, then $\lfloor X \rfloor$ is geometrically distributed which value is starting from $0$. Let $n\geq 0$ be a given nonnegative integer. Then we have
$$
P(\lfloor X \rfloor \geq n) = P(X\geq n) = e^{-\lambda n}.  
$$
Thus, it follows that $\lfloor X \rfloor$ is geometrically distributed  with parameter $p=1-e^{-\lambda}$ which starts with value $0$. This has expectation $\frac 1p -1$. 
In the problem we have $\lambda =1$. Thus, the answer is 
$$
\mathbf{E}[ \lfloor X \rfloor ] = \frac { e^{-1} }{1-e^{-1} } = \frac 1{e-1}.
$$
A: First note that $\int_0^{\infty}\lfloor x\rfloor e^{-x}\;dx=\sum_{n=0}^{\infty}\int_{n}^{n+1}\lfloor x\rfloor e^{-x}\;dx$ by the additivity of the integral.
This decomposition is useful because $\lfloor x\rfloor$ is equal to $n$ on the interval $[n,n+1)$. So we can rewrite the integral as
$$ \sum_{n=0}^{\infty}\int_{n}^{n+1}\lfloor x\rfloor e^{-x}\;dx=\sum_{n=0}^{\infty}\int_{n}^{n+1}n e^{-x}\;dx$$
Finally, the sum can be changed to start at $n=1$ if we want, since the $n=0$ term is zero anyway.
