Compute $\int_{0}^{1}\left[\frac{2}{x}\right]-2\left[\frac{1}{x}\right]dx$ The question is to find
$$\int_{0}^{1}\left(\left[\dfrac{2}{x}\right]-2\left[\dfrac{1}{x}\right]\right)dx,$$
where $[x]$ is the largest integer no greater than $x$, such as $[2.1]=2, \;[2.7]=2,\; [-0.1]=-1.$
Is there any nice method to solve this integral,Thank you everyone.

Some of my thoughts: I have if $a\in(0,1]$, then
$$\int_{0}^{1}\left[\dfrac{a}{x}\right]-a\left[\dfrac{1}{x}\right]dx=a\ln{a}.$$
What about $a>1$,
$$\int_{0}^{1}\left[\dfrac{a}{x}\right]-a\left[\dfrac{1}{x}\right]dx=?$$
and  $$\int_{0}^{1}\left(\left[\dfrac{2}{x}\right]-2\left[\dfrac{1}{x}\right]\right)^{2}dx=?$$
becasue I have
$$\int_{0}^{1}\left(\dfrac{1}{x}-\left[\dfrac{1}{x}\right]\right)^2=-1-\gamma+\ln{(2\pi)}$$

We have
$$\left\lfloor \dfrac1x \right\rfloor = n \text{ if }x \in \left(\dfrac1{n+1}, \dfrac1n\right]$$
$$\left\lfloor \dfrac2x \right\rfloor = \begin{cases}2n+1 & \text{ if }x \in \left(\dfrac1{n+1}, \dfrac1{n+1/2}\right] \\ 2n & \text{ if }x \in \left(\dfrac1{n+1/2}, \dfrac1{n}\right] \end{cases}$$
We hence have
$$\left\lfloor \dfrac2x \right\rfloor - 2 \left\lfloor \dfrac1x \right\rfloor = \begin{cases} 1 & \text{ if }\left(\dfrac1{n+1}, \dfrac1{n+1/2}\right] \\ 0 & \text{ if }x \in \left(\dfrac1{n+1/2}, \dfrac1{n}\right] \end{cases}$$
Hence,
$$\int_0^1 \left( \left\lfloor \dfrac2x \right\rfloor - 2 \left\lfloor \dfrac1x \right\rfloor\right) dx = \sum_{n=1}^{\infty} \left(\dfrac1{n+1/2} - \dfrac1{n+1}\right) = 2\log2-1$$
One way to evaluate $$\sum_{n=1}^{\infty} \left(\dfrac1{n+1/2} - \dfrac1{n+1}\right)$$ is as follows. We have
$$f(x) = \sum_{n=1}^{\infty} \left(x^{n-1/2} - x^{n} \right) = \sum_{n=1}^{\infty} x^{n-1}\left(\sqrt{x} -x\right) = \dfrac{\sqrt{x}-x}{1-x} = \dfrac{\sqrt{x}}{1+\sqrt{x}}$$
Now we have
$$\int_0^1 f(x) dx = \sum_{n=1}^{\infty} \left(\int_0^1 x^{n-1} dx - \int_0^1 x^{n-1/2} dx\right) = \sum_{n=1}^{\infty} \left(\dfrac1n - \dfrac1{n+1/2}\right)$$
We also have
\begin{align}
\int_0^1 f(x) dx & = \int_0^1 \dfrac{\sqrt{x}dx}{1+\sqrt{x}} = \int_0^1 \dfrac{2t^2dt}{1+t} = 2\int_0^1 \dfrac{dt}{1+t} + 2\int_0^1 \dfrac{(t^2-1)dt}{1+t}\\
& = 2 \log(2) + 2 \int_0^1 (t-1) dt= 2\log(2)-1
\end{align}
