Why this simple relation between two complicated sums? I have the two following sums:
$$A_N =\sum_{n=0}^N\sum_{\substack{m=0 \\ m\neq n}}^N 1/\sqrt{n+m-2\sqrt{nm}}$$
$$B_{N,p} =\sum_{n=0}^N\sum_{\substack{m=0 \\ m\neq n}}^N 1/\sqrt{n+m-2\sqrt{nm}\cos{(2\pi(n-m)/p)}}$$
with $p$ a positive integer. Numerically, I find the following "conjecture":
$$ B_{N,p} \to \frac{A_N}{p},$$
when $N \to \infty $. I would like to find a way to prove this, but I found no fruitful approach so far. Could anyone help me with that? Any ideas or hints would be very appreciated!
 A: Yes, the "conjecture" holds (in the form of $\color{blue}{B_{N,p}/A_N\to1/p}$ as $N\to\infty$). The basic idea is simple: the main contribution to $B_{N,p}$ is given by the terms with $n\equiv m\pmod p$. The next thing we need is $$\lim_{N\to\infty}\frac{1}{N^{3/2}\log N}\sum_{0<n<m<N}\frac{1}{\sqrt{m}-\sqrt{n}}=\frac43.\tag{L}\label{mainlim}$$
To show it, let the sum be $S_N$, and use (for the rightmost inequality, we assume $m-n>1$) $$\iint\limits_{\substack{m\leqslant x\leqslant m+1\\n-1\leqslant y\leqslant n}}\frac{dx\,dy}{\sqrt{x}-\sqrt{y}}\leqslant\frac{1}{\sqrt{m}-\sqrt{n}}\leqslant\iint\limits_{\substack{m-1\leqslant x\leqslant m\\n\leqslant y\leqslant n+1}}\frac{dx\,dy}{\sqrt{x}-\sqrt{y}}.$$
Summing the lower bound over $0<n<m<N$, we obtain a lower bound for $S_N$ as the integral over a domain that contains $\{(x,y):0\leqslant y\leqslant x-2\leqslant N-2\}$. And an upper bound for $S_N$ is the sum of $$\sum_{m=2}^N\frac{1}{\sqrt{m}-\sqrt{m-1}}+\sum_{m=3}^N\frac{1}{\sqrt{m}-\sqrt{m-2}}=\mathcal{O}\left(\sum_{m=1}^N\sqrt{m}\right)=\mathcal{O}(N^{3/2})$$ and the integral over a domain that is contained in $\{(x,y):1\leqslant y\leqslant x-1\leqslant N-2\}$: $$\iint\limits_{\substack{2\leqslant x\leqslant N\\0\leqslant y\leqslant x-2}}\frac{dx\,dy}{\sqrt{x}-\sqrt{y}}\leqslant S_N\leqslant\mathcal{O}(N^{3/2})+\iint\limits_{\substack{2\leqslant x\leqslant N-1\\1\leqslant y\leqslant x-1}}\frac{dx\,dy}{\sqrt{x}-\sqrt{y}}.$$ The integrals may be evaluated exactly (by substituting $x=y+z$ and doing the inner integration over $y$; let me omit the details), and both appear to be $(4/3)N^{3/2}\big(\log N+\mathcal{O}(1)\big)$. This completes the proof of $\eqref{mainlim}$.
This also gives the asymptotics of $A_N\asymp(8/3)N^{3/2}\log N$ and, more generally, for any $0\leqslant b<a$ $$\sum_{0\leqslant n<m\leqslant N}\frac{1}{\sqrt{am+b}-\sqrt{an+b}}\asymp\frac43\sqrt\frac{N^3}{a}\log N.\qquad(N\to\infty)\tag{A}\label{asympto}$$
Now, as planned at the beginning, we split $B_{N,p}=E_{N,p}+D_{N,p}$, where $$E_{N,p}=2\sum_{\substack{0\leqslant n<m\leqslant N\\n\equiv m\pmod p}}a_p(n,m),\quad D_{N,p}=\sum_{\substack{0\leqslant n,m\leqslant N\\n\not\equiv m\pmod p}}a_p(n,m),\\a_p(n,m)=\big[n+m-2\sqrt{nm}\cos\big(2\pi(n-m)/p\big)\big]^{-1/2}.$$
The sum in $E_{N,p}$ is over pairs $(n,m)=(n'p+r,m'p+r)$ with $0\leqslant n'<m'\leqslant\lfloor(N-r)/p\rfloor$ and $0\leqslant r\leqslant p-1$; since $a_p(n,m)=(\sqrt{m'p+r}-\sqrt{n'p+r})^{-1}$ then, we use $\eqref{asympto}$ and get $$E_{N,p}\asymp\frac83\sum_{r=0}^{p-1}\sqrt\frac{\lfloor(N-r)/p\rfloor^3}{p}\log N\asymp\frac{8}{3p}N^{3/2}\log N.$$
For $D_{N,p}$ finally, we have $2\sqrt{nm}\leqslant n+m$ and $a_p(n,m)\leqslant\big[(n+m)\big(1-\cos(2\pi/p)\big)\big]^{-1/2}$, hence $$D_{N,p}\leqslant\frac{1}{\sqrt{1-\cos(2\pi/p)}}\sum_{0\leqslant n\neq m\leqslant N}\frac{1}{\sqrt{n+m}}=\mathcal{O}(N^{3/2}).$$
Gathering these asymptotic results, we obtain the claim stated at the beginning.
Update (an elementary approach, avoiding integrals)

*

*$\color{blue}{A_N=\Omega(N^{3/2}\log N)}$ follows from $$A_N=2\sum_{0\leqslant n<m\leqslant N}(\sqrt{m}-\sqrt{n})^{-1}=2\sum_{d=1}^N\sum_{n=0}^{N-d}(\sqrt{n+d}-\sqrt{n})^{-1}\\=2\sum_{d=1}^N\frac1d\sum_{n=0}^{N-d}(\sqrt{n+d}+\color{LightGray}{\sqrt{n}})\geqslant2\sum_{d=1}^N\frac1d\sum_{n=d}^N\sqrt{n}=2\sum_{n=1}^N\sqrt{n}\sum_{d=1}^n\frac1d\\\geqslant2\sum_{n=1}^N\sqrt{n}\log n\geqslant2(N/2)\sqrt{N/2}\log(N/2).\qquad(N>1)$$


*$\color{blue}{E_{N,p}/A_N\to1/p}$ is shown using the increase of $r\mapsto a_p(n'p+r,m'p+r)$; this gives lower/upper bounds for $E_{N,p}$ in terms of something like $A_{\lfloor N/p\rceil}$, and the same can be done for $A_N$ itself (to avoid dealing with $A_{\lfloor N/p\rceil}/A_N$).


*The $\color{blue}{D_{N,p}=\mathcal{O}(N^{3/2})}$ above is shown elementarily.
