Integral of greatest integer function divided by an exponential If $\lfloor x \rfloor$ denotes the greatest integer not exceeding $x$, then find $\displaystyle\int_{0}^{\infty} \displaystyle \frac{\lfloor x \rfloor}{e^{x}} dx$. The correct answer is supposed to be $\frac{1}{e-1}$.
In order to wrap my head around this problem, I wanted to see if there was a pattern for what was going on for each of the integrals $\displaystyle \int_{n}^{n+1}\displaystyle \frac{\lfloor x \rfloor}{e^{x}}dx$. Each one is equal to $\displaystyle \frac{n(e-1)}{e^{n+1}}$. I figured then that a good way to solve this problem, then, was to sum up the infinite series, $\displaystyle \sum_{n=0}^{\infty}\frac{n(e-1)}{e^{n+1}}$.
Now, I believe that this series must converge, since the trapezoids formed by the x-axis and each $\displaystyle \frac{n}{e^{x}}$ become infinitesimally small as $n$ gets large. However, it's not a geometric series, so I am not sure how to find what it converges to, which, from the answer to the problem, must be $\frac{1}{e-1}$.
Am I going about this in an unnecessarily complicated way, and is there a simpler method to evaluate this integral? If not, what is the piece that I'm missing? Thanks :)
 A: Your way is fine, it's just a matter of recognising a differentiated geometric series in that:
$$\begin{align}
\sum_{n=0}^\infty \frac{n(e-1)}{e^{n+1}} &= \sum_{n=0}^\infty \frac{e-1}{e^2} \cdot \frac{n}{e^{n-1}}\\
&= \frac{e-1}{e^2} \sum_{n=0}^\infty n\left(\frac{1}{e}\right)^{n-1}\\
&= \frac{e-1}{e^2} \frac{1}{\left(1-\frac{1}{e}\right)^2}\\
&= \frac{e-1}{(e-1)^2}\\
&= \frac{1}{e-1}.
\end{align}$$
In a similar way, when you have a series
$$\sum_{n=0}^\infty p(n)\cdot x^{n+d}$$
with a polynomial $p$ of degree $k$, then you can write that as a linear combination of derivatives of the geometric series with ratio $x$ of orders $\leqslant k$.
A: Our integral is
$$\int_0^\infty xe^{-x}\,dx-\int_0^\infty \left(x-\lfloor x\rfloor\right)e^{-x}\,dx.\tag{1}$$
The first integral in (1) has value $1$. For the second integral, split as you did as a sum of integrals
$$\int_n^{n+1} (x-n)e^{-x}\,dx.$$
Integrate. We get $\frac{e-2}{e}e^{-n}$. Summing from $0$ to $\infty$ we get $\frac{e-2}{e-1}$.
Thus the expression (1) is equal to $1-\frac{e-2}{e-1}$, which is $\frac{1}{e-1}$. 
A: Another method consists in using a Fourier series :

Of course, it's not so easy, but it's a nice exercise !
