<s>[INST] Limit question using limit as a sum 
$$\lim_{n\rightarrow \infty}\frac{1}{n}\bigg(\sum^{n}_{i=1}\left\lfloor \frac{2n}{i}\right\rfloor-2\left\lfloor\frac{n}{i}\right\rfloor \bigg)$$
Where $\lfloor x \rfloor$ is a floor function of $x$

Trial: using limit as a sum put $\displaystyle \frac{i}{n}=x$ and $\displaystyle \frac{1}{n}=dx$
$$\int^{1}_{0}\bigg(\left\lfloor\frac{2}{x}\right\rfloor -2\left\lfloor\frac{1}{x}\right\rfloor \bigg)dx$$
Let $\displaystyle \frac{1}{x}=t$ and $dx=-\frac{1}{t^2}dt$
So $\displaystyle \int^{1}_{0}\bigg(\lfloor 2t \rfloor - 2\lfloor t\rfloor \bigg)\cdot\frac{1}{t^2}dt$
Could some help me to solve it, Thanks
 [/INST] Write $I$ for the integral and notice that
$$
I
= \int_{0}^{1} \left( \left\lfloor \frac{2}{x} \right\rfloor - 2 \left\lfloor \frac{1}{x} \right\rfloor \right) \, dx
= \int_{0}^{1} \left( \left\lfloor \frac{2}{x} \right\rfloor - \frac{2}{x} \right) \, dx + 2\int_{0}^{1} \left( \frac{1}{x} - \left\lfloor \frac{1}{x} \right\rfloor \right) \, dx
$$
(Without adding and subtracting the intermediate term $\frac{2}{x}$, you have $\infty-\infty$ indeterminate which is never good.) Now by the substitution $x \mapsto x/2$, the second integral becomes
$$ 2\int_{0}^{1} \left( \frac{1}{x} - \left\lfloor \frac{1}{x} \right\rfloor \right) \, dx
= \int_{0}^{2} \left( \frac{2}{x} - \left\lfloor \frac{2}{x} \right\rfloor \right) \, dx $$
Plugging this back, we find that
$$
I
= \int_{1}^{2} \left( \frac{2}{x} - \left\lfloor \frac{2}{x} \right\rfloor \right) \, dx
= \int_{1}^{2} \left( \frac{2}{x} - 1 \right) \, dx
= 2\log 2 - 1.
$$
</s>