How can I calculate the following integral? $$
 \int_{a}^{b} \left \lfloor \frac{1}{u} \right \rfloor u du 
$$
I can't really tell what I should do in this case. I have calculated integrals of floor functions before, but this one is really not working...
 A: The integrand $f:\mathbb{R} \to\mathbb{R}$ defined as
$$\tag{1} f(x)~:=~ \left\{\begin{array}{lcl} 
x \left\lfloor \frac{1}{x} \right\rfloor &{\rm for}& x\neq 0 ,\cr 1  &{\rm for}& x= 0,\end{array} \right. $$
satisfies the double inequality
$$\tag{2}    1-x^+ ~\leq~ f(x)~ \leq~ 1+ x^-,$$ 
and hence $f\in{\cal L}^1_{\rm loc}(\mathbb{R})$ is locally integrable. The integral 
$$\tag{3} I(a,b)~:=~ \int_a^b \!dx~ f(x)$$ 
is therefore a continuous function of the two endpoints $a$ and $b$. We assume that $a\leq b$. We claim that the integral (3) is
$$\tag{4} I(a,b) ~=~ F(b) - F(a) 
+ \sum_{n\in \mathbb{Z}\backslash \{0\}}^{a\leq \frac{1}{n}<b}\frac{1}{2n^2} ,$$
where we have defined a function $F:\mathbb{R} \to\mathbb{R}$ by
$$\tag{5} F(x)~:=~ \left\{\begin{array}{lcl} 
\frac{x^2}{2} \left\lfloor \frac{1}{x} \right\rfloor &{\rm for}& x\neq 0 ,\cr 0  &{\rm for}& x= 0.\end{array} \right. $$
Sketched proof: One may check that eq. (4) is differentiable in $a$ and $b$; that $I(a,a)=0$; and that
$$ \tag{6} \frac{\partial I(a,b)}{\partial b}~=~ f(b) .$$
