Approximation of Sum of Product of Floor Functions Given that $n$ is some integer, what is an asymptotically approximation (gets better as $x$ gets larger) of $$f(x)=\int_{1}^x \mathbb{floor}(k)\mathbb{floor}(\frac{n}{k}) dk$$ This only needs to be accurate for $1 \le x<\sqrt{n} $
 A: By using $x-1\lt\lfloor x\rfloor\le x$ one can make some trivial bounds on the value of $f(x)$
$$\sum_{k=1}^x\left(\frac{n}{k}-1\right)\lt f(x)\le\sum_{k=1}^x\frac{n}{k}$$
$$-x+n\sum_{k=1}^x\frac{1}{k}\lt f(x)\le n\sum_{k=1}^x\frac{1}{k}$$
$$-x+n(\gamma+\ln{(x)})\lt f(x)\lt n\left(\gamma+\ln{(x)}+\frac1{2x}\right)$$
In fact the approximation $\lfloor x\rfloor\approx x$ seems to numerically work well for $1\le x\lt\sqrt{n}$ so one can just use
$$f(x)\approx\sum_{k=1}^x\frac{n}{k}\sim n\left(\gamma+\ln{(x)}+\frac1{2x}-\frac1{12x^2}+\dots\right)$$
A: Hint:
$$
\eqalign{
  & f(x) = \int_1^x {\left\lfloor k \right\rfloor \left\lfloor {{n \over k}} \right\rfloor dk}  =   \cr 
  &  = \int_1^x {\left( {k - \left\{ k \right\}} \right)\left( {{n \over k} - \left\{ {{n \over k}} \right\}} \right)dk}  =   \cr 
  &  = \int_1^x {\left( {n - k\left\{ {{n \over k}} \right\} - \left\{ k \right\}{n \over k} + \left\{ k \right\}\left\{ {{n \over k}} \right\}} \right)dk}  =   \cr 
  &  = n\left( {x - 1} \right) - \int_1^x {k\left\{ {{n \over k}} \right\}dk}  - \int_1^x {\left\{ k \right\}{n \over k}dk + \int_1^x {\left\{ k \right\}\left\{ {{n \over k}} \right\}dk} }  \cr} 
$$
can you continue ?
