How to prove that $\sum_{m\leqslant x}\sum_{n\leqslant x}\Big\{\frac{x}{m+n}\Big\}=\Big(2\log2-\frac{\pi^2}{12}\Big)x^2+O(x\log x)$? Prove that $$\sum_{m\leqslant x}\sum_{n\leqslant x}\Big\{\frac{x}{m+n}\Big\}=\Big(2\log2-\frac{\pi^2}{12}\Big)x^2+O(x\log x),$$
where $\{x\}$ is the fractional part of the real number $x$.
I know
$$\sum_{n\leqslant x} \Big\{\frac{x}{n} \Big\}=(1-\gamma)x+O\big(x^{1/2}\big),$$
where $\gamma$ is Euler's constant. But I don't know whether it is useful. Can you help me?
 A: Write $\{x\} = x - \lfloor x\rfloor$,s so that
\[\sum_{m \leq x} \sum_{n \leq x} \left\{ \frac{x}{m + n}\right\} = \sum_{m \leq x} \sum_{n \leq x} \frac{x}{m + n} - \sum_{m \leq x} \sum_{n \leq x} \left\lfloor \frac{x}{m + n}\right\rfloor.\]
Then note that
\[\sum_{m \leq x} \sum_{n \leq x} \left\lfloor \frac{x}{m + n}\right\rfloor = \sum_{m \leq x} \sum_{n \leq x} \sum_{\ell \leq \frac{x}{m + n}} 1 = \sum_{\ell \leq \frac{x}{2}} \sum_{n \leq \frac{x}{\ell} - 1} \sum_{m \leq \frac{x}{\ell} - n} 1.\]
The sum over $m$ is $\lfloor x/\ell\rfloor - n$. The ensuing sum over $n$ is
\[\left\lfloor \frac{x}{\ell}\right\rfloor \left(\left\lfloor \frac{x}{\ell}\right\rfloor - 1\right) - \sum_{n \leq \frac{x}{\ell} - 1} n.\]
Via partial summation,
\[\sum_{n \leq \frac{x}{\ell} - 1} n = \left(\frac{x}{\ell} - 1\right) \left(\left\lfloor \frac{x}{\ell} \right\rfloor - 1\right) - \int_{1}^{\frac{x}{\ell} - 1} \lfloor t\rfloor \, dt,\]
and this integral is equal to $\frac{1}{2} \left(\frac{x}{\ell} - 1\right)^2 + O(\frac{x}{\ell})$. So the sum over $n$ and $m$ simplifies to
\[\frac{x^2}{2 \ell^2} + O\left(\frac{x}{\ell}\right).\]
The ensuing sum over $\ell$ is
\[\frac{x^2}{2} \sum_{\ell = 1}^{\infty} \frac{1}{\ell^2} - \frac{x^2}{2} \sum_{\ell > \frac{x}{2}} \frac{1}{\ell^2} + O(x \log x).\]
The first sum over $\ell$ is $\zeta(2) = \pi^2/6$. The second is $O(1/x)$. So this simplifies to
\[\frac{\pi^2 x^2}{12} + O(x \log x).\]
Now we deal with
\[\sum_{m \leq x} \sum_{n \leq x} \frac{x}{m + n} = x \sum_{m \leq x} \sum_{n \leq x} \frac{1}{m + n}.\]
We deal with the sum over $n$ via partial summation: it is equal to
\[\frac{\lfloor x\rfloor}{m + x} + \int_{1}^{x} \frac{\lfloor t \rfloor}{(m + t)^2} \, dt = \log \frac{m + x}{m + 1} + O\left(\frac{1}{m}\right),\]
where we have used the fact that $\lfloor x \rfloor = x - \{x\} = x + O(1)$, the fact that the antiderivative of $t/(m + t)^2$ is $m/(m + t) + \log(m + t)$, and the fact that the antiderivative of $1/(m + t)^2$ is $-1/(m + t)$.
So it remains to evaluate
\[\sum_{m \leq x} \log \frac{m + x}{m + 1} = \lfloor x\rfloor \log \frac{2x}{x + 1} + (x + 1) \int_{1}^{x} \frac{\lfloor t\rfloor}{(t + x)(t + 1)} \, dt.\]
The antiderivative of $\frac{t}{(t + x)(t + 1)}$ is $\frac{x}{x - 1} \log \frac{t + x}{t + 1}$, and so after some simplification, we arrive at $(2\log 2) x + O(\log x)$.
A: In general, Minghui Ma and Daoyi Peng proved the following theorem, you can see (in Chinese) https://www.cnblogs.com/pengdaoyi/p/9270207.html
For $k\geqslant 3$,
\begin{equation*}   \sum_{n_1=1}^{N} \dotsc \sum_{n_{k}=1}^{N}   \left\{ \frac{N}{n_1+\dotsb+n_k} \right\}   = \left( \frac{1}{(k-1)!}\sum_{j=2}^{k}  (-1)^{k+j} j^{k-1} \binom{k}{j} \log j - \frac{\zeta(k)}{k!} \right) N^{k} + O\big(N^{k-1}\big),
\end{equation*}
where $\binom{k}{j}=\frac{k!}{j!(k-j)!}$ is binomial coefficient, $\zeta(k)=\sum\limits_{\ell=1}^{\infty} \frac{1}{\ell^k}$ is the Riemann zeta function.
when $k=2$,
\begin{equation}
\sum_{n_1=1}^{N} \sum_{n_2=1}^{N} \left\{ \frac{N}{n_1+n_2} \right\}    = \left(2\log2-\frac{\zeta(2)}{2}\right)N^2+O(N\log N),
\end{equation}
with $\zeta(2)=\frac{\pi^2}{6}$.
When $k=1$,
\begin{equation*} \int_{0}^{1} \left\{ \frac{1}{x_1} \right\} \mathrm{d}x_{1} = 1-\gamma. \end{equation*}
If $k\geqslant 2$,
\begin{equation*} \int_{0}^{1} \dotsi \int_{0}^{1} \left\{ \frac{1}{x_1+\dotsb+x_k} \right\} \mathrm{d}x_{1} \dotsm \mathrm{d}x_{k} = \frac{1}{(k-1)!}\sum_{j=2}^{k} (-1)^{k+j} j^{k-1} \binom{k}{j} \log j - \frac{\zeta(k)}{k!}. \end{equation*} 
