TITLE: Simple integral help
QUESTION [17 upvotes]: How do I integrate $$\int_{0}^1 x \bigg\lceil \frac{1}{x} \bigg\rceil \left\{ \frac{1}{x} \right\}\, dx$$
Where $\lceil x \rceil $ is the ceiling function, and $\left\{x\right\}$ is the fractional part function

REPLY [3 votes]: Split the integral up into segments $S_m=[1/m,1/(m+1)]$ with $[0,1]= \cup_{m=1}^\infty S_m$. In the segment $m$, we have $\lceil 1/x \rceil=m+1$ and $\{1/x\} = 1/x- \lfloor 1/x\rfloor = 1/x - m$ (apart from values of $x$ on the boundary which do not contribute to the integral).
This yields
$$\begin{align}\int_0^1 x \bigg\lceil \frac{1}{x} \bigg\rceil \left\{ \frac{1}{x} \right\}\, dx &= \sum_{m=1}^\infty \int_{S_m}x \bigg\lceil \frac{1}{x} \bigg\rceil \left\{ \frac{1}{x} \right\}\, dx \\
&= \sum_{m=1}^\infty \int_{1/(m+1)}^{1/m} x (m+1)\left(\frac1x -m \right)\, dx\\
&= \sum_{m=1}^\infty \frac{1}{2m(1+m)}\\
&=\frac{1}{2}.
\end{align}$$