Let $p, q$ be two distinct prime number. I'm trying to provide a non-trivial upper bound for the sum
$$S(p, q) = \sum\_{1 \leq x < p} \sum\_{1 \leq y < q} \frac{1}{\|x / p\| \, \|y / q\| \, \|x/p + y/q\|},$$
where $\|t\|$ denotes the distance of $t \in \mathbb{R}$ from the nearest integer.


Precisely, I'm interested in having $S(p, q) = o((pq)^2)$ as $p, q$ go to infinity in some way.


I know that $\min(p, q) \to +\infty$ doesn't suffices, since $S(p, q) \geq (pq)^2 / (q - p)$ (considering $x = 1$ and $y = q - 1$), and we can take a sequence of primes $p\_k < q\_k$ such that $p\_k \to +\infty$ and $q\_k - p\_k$ is bounded.


Maybe $S(p, q) = o((pq)^2)$ as $p \to +\infty$ and $q/p \to +\infty$ ?


The motivation comes from the fact that
$$\sum\_{\substack{1 \leq z < pq \\ (pq, z) = 1}} \frac1{|p^{-1}z \bmod q|\,|q^{-1}z \bmod p| \, z} = \frac{S(p, q)}{(pq)^2} ,$$
where $|p^{-1}z \bmod q| = \min\{|r| : r \in \mathbb{Z}, pr \equiv z \pmod q\}$, and similarly for $|q^{-1}z \bmod p|$. Therefore, $S(p, q) = o((pq)^2)$ means that, on average, $|p^{-1}z \bmod q|$, $|q^{-1}z \bmod p|$, and $z$ cannot be all small.


Thanks for any help



Non-trivial upper bound for a sum related to $p^{-1}z \pmod q$ and $q^{-1}z \pmod p$
If you just want $o()$, the story is rather simple. Let $a\_{xy}$ be the remainder of $qx+py\mod pq$ where all remainders modulo $P$ are assumed to be between $-P/2$ and $P/2$. Note that all $a\_{xy}$ are distinct, so if we have any set $Z$ of pairs $(x,y)$, then $\sum\_{(x,y)\in Z}\frac 1{a\_{xy}}\le 2(1+\log|Z|)$. What we want to show is just
$$
\sum\_{0<|x|<p/2, 0<|y|<q/2}\frac 1{|xya\_{xy}|}=o(1)\,.
$$
Now for $k=0,1,2\dots$ consider $Z\_k=\{(x,y): 2^k\le |xy|<2^{k+1}\}$ and note that $|Z\_k|\le C(k+1)2^{k}$. Thus the sum over $Z\_k$ is at most
$2^{-k}(1+\log|Z\_k|)\le C(k+1)2^{-k}$ regardless of $p,q$. Thus the only danger is that the sum over $Z\_k$ for some fixed $k$ does not tend to $0$, i.e., that there exists $C>0$ such that $ap+bq+c=0$ for some $a,b,c$ with $0<|a|+|b|+|c|<C$ along a subsequence of pairs $(p,q)$ you are considering (in which case the corresponding term alone gives a positive constant). If you eliminate this possibility in any way ($q/p\to+\infty$ is more than enough), then you are in good shape.


