On the distribution of modular square roots of primes

We use recent bounds on bilinear sums with modular square roots to study the distribution of solutions to congruences $x^2 \equiv p \pmod q$ with primes $p\le P$ and integers $q \le Q$. This can be considered as a combined scenario of Duke, Friedlander and Iwaniec with averaging only over the modulus $q$ and of Dunn, Kerr, Shparlinski and Zaharescu with averaging only over $p$.

1. Introduction 1.1.Motivation.We recall that the celebrated work of Duke, Friedlander and Iwaniec [8,9], see also [20,31], establishes the uniformity of distribution of fractions x(n, q)/q formed by all solutions to quadratic congruence (1.1) x 2 ≡ n (mod q), 1 x q , for a given integer n and the prime modulus q that runs up to some bound q Q.These results have had an enormous number of applications, see for example [1,5,6,9,25,26,29].
In [10] a somewhat dual question has been considered about the distribution of x(p, q)/q for a fixed prime q when p runs over primes p P for some parameter P , with non-trivial estimates provided that P q 2/3+ε with some fixed ε > 0.
Here we consider a combined scenario of congruences x 2 ≡ p (mod q) when p varies over primes p P and q varies over integers q Q.
More precislely, given a prime q and a real parameter P we consider the set R q (P ) of primes p P which are quadratic residues modulo q.Following [10], we are interested in the distribution of solutions to the congruence x 2 ≡ p (mod q), p ∈ R q (P ) .Obviously to be able to answer this question one needs good lower bounds on the abundance of primes in R q (P ), that is, on the cardinality R q (P ) = #R q (P ) .
Unfortunately, unless P is exponentially large, all known results of this type are conditional on the Generalised Riemann Hypotheis or other conjectures on the zero-free regions of L-functions, see [10].
Here we show that a result of [10] on square roots of primes in residue rings modulo q can be improved on average over q and can also be given in a fully unconditional form.This is based on two ingredients: • an asymptotic formula for R q (P ) on average over q which follows from a large sieve-type result of Heath-Brown [17] on average values of sums of real characters; • a new bound of bilinear sums with modular square roots of integers from [30] which we couple with the Heath-Brown identity (see [21,Proposition 13.3]) to estimate exponential sums with square roots of primes.As we have noticed, our result is an unconditional averaged version of a result from [10] with averaging over the modulus q.It can also be viewed as an averaged version of results of Duke, Friedlander and Iwaniec [8,9], Homma [20] and [31], to the scenario when n in (1.1) varies over primes p P .
Finally, we mention that the results and methods of [23,24] undoubtedly lead to a uniformity of distribution result for solutions to (1.2) x 2 ≡ p (mod q k ), p ∈ R q (P ) , with a fixed odd prime q as k → ∞, starting with very short intervals, namely, already for P q εk with any fixed ε > 0 (clearly p ∈ R q (P ) is equivalent to the solvability of (1.2)).
1.2.New result.More precisely, given λ ∈ Z × q , where Z × q is the unit group of the residue ring Z q modulo q, and two real numbers, we define ∆ λ,q (P ) = max where a T λ,q (P ; X, Y ) denotes the number of x ∈ [Y + 1, Y + X] with x 2 ≡ λp (mod q) for some prime p P and, as usual, π(P ) denotes the number of primes p P .
In [10] the discrepancy ∆ λ,q (P ) is estimated under the condition that for the given prime q, the number of prime quadratic residues p P is close to its expected value 0.5π(P ).Here we take advantage of averaging over q prime and obtain an unconditional result with a stronger bound on average.Theorem 1.1.Let 1 P Q.Then we have 1) .
It is easy to see that Theorem 1.1 is nontrivial for P Q 1/2+ε with some fixed ε > 0, while for P = Q we get ∆ λ,q (q) q 11/12+o (1) , for almost all primes q, uniformly over λ ∈ Z × q .Perhaps considering more cases in the proof of Theorem 1.1 one can obtain a improve the bound of Theorem 1.1.However our goal has been to have a nontrivial result in a range of P as wide as possible and we believe that the above condition P Q 1/2+ε is the limit of our method.
Clearly, using Theorem 1.1 one can provide averaged versions of many applications which rely on the bound of Duke, Friedlander and Iwaniec [9,Theorem 1.1]; some of them are indicated already in [9], some other can be found in [1,6,25,26].

Links to other problems
2.1.Local spacings.The local spacing distribution of the sequence n 2 α mod 1 for α irrational has been extensively studied in the literature.A classical result of Rudnick and Sarnak states that for all integers d 2 and almost all real α, the pair correlation of the sequence n d α mod 1 is Poissonian.This is in contrast with the case d = 1, where it is well known that for all α and all N, the gaps between consecutive elements of fractional parts {nα}, 1 n N, can take at most three values.Returning to the case d = 2, Rudnick, Sarnak and Zaharescu [28,33] have shown that for sufficiently well approximable numbers α, the m-level correlations and consecutive spacings are Poissonian along subsequences.For α = √ 2, these types of conjectures are supported numerically [16] because of their close connection to the distribution between neighbouring levels of a certain integrable quantum system.
A difficult problem is that of the distribution of local spacings between consecutive primes.Gallagher [14] proves that the sequence of primes has a Poissonian distribution, conditionally under the assumption of (a uniform version of) an even more famous conjecture, the prime k-tuple conjecture.
Let us now take a large prime number q and consider two sequences modulo q: the sequence of primes up to q, and the sequence of squares of positive integers up to N. Suppose N is of the size of q/ log q, so that the above two finite sequences have about the same number of elements.By Gallagher's result [14], the first sequence has a Poissonian distribution, conditionally under the prime k-tuple conjecture.Unconditionally, by [28], the second sequence has a Poissonian distribution for N of the above size.Under these circumstances one would naturally expect that if one takes the union of these two sequences, the new sequence has a Poissonian distribution, too.Thus, for example, the nearest-neighbor distribution should be exponential: for each fixed λ > 0, the proportion of gaps between consecutive elements of the sequence (arranged increasingly in the interval [1, q]) should tend to e −λ , as q tends to infinity.Note that the distribution problem for this combined sequence introduces new challenges.Thus, if one wants to count neighbours (pairs of consecutive elements of the sequence) asymptotically, one needs to deal with four types of pairs: pairs where both elements are primes (counted in [14]), pairs where both elements are squares mod q (counted in [28]), as well as new types of pairs, where one element is a prime and the other is a square.Counting these new types of pairs leads one to study the problem of finding, for each fixed integer h, an asymptotic formula for the number of solutions to the congruence n 2 ≡ p + h (mod q).Here the case h = 0 would need to be included, too, and in that case the problem reduces to the congruence discussed in the present paper.
2.2.Diophantine inequalities.Diophantine inequalities with primes and respectively with squares have a long history.In the case of primes, Matomäki [27] proved that for any real irrational number α, and any ε > 0, there are infinitely many prime numbers p for which where ξ denotes the distance between ξ and the closest integer.
In the case of squares, it is shown in [32] that for any real irrational number α and any ε > 0, there are infinitely many positive integers n for which The following question naturally arises: Given a real irrational number α and positive integers P and N, can one find a prime p P and a positive integer n N such that pα and n 2 α are close to each other modulo 1?
Here one may expect that since n can take N values and p can take about P/ log P values, there should be a pair (p, n) for which the distance between the fractional part of pα and the fractional part of n 2 α is less than 1/(P N) 1−ε .Such an expectation is simply false.
Indeed, consider for instance the case P = N 2 .Then all the differences p−n 2 that can appear are nonzero integers in the interval [−P, P ].Recall that Dirichlet's theorem is best possible: almost all real numbers have Diophantine type exactly 2. For such an α, one cannot find nonzero integers m in the interval [−P, P ] for which mα < 1/P 1+ε , and therefore one cannot find a pair (p, n) as above for which the distance between the fractional part of pα and the fractional part of n 2 α is less than 1/P 1+ε .
We remark that for the same real numbers α, (that is, of Diophantine type equal to 2) one can combine [27] with [32] to conclude that for infinitely many P = N 2 as above, there exist pairs (p, n) for which To obtain the result one actually makes both pα and n 2 α smaller than 1/P 1/3−ε .This applies in particular to the case when the given real irrational number α is algebraic, by the Thue-Siegel-Roth theorem.
Let us remark that the above type of questions have connections with some celebrated unsolved problems involving primes and squares.For example, a well known conjecture of Hardy and Littlewood states that every large enough positive integer is either a square, or the sum of a prime and a square.Assuming this holds true, and applying it to m above (or applying it to 2m in case m is a square), it follows that there is a pair (p, n) such that the fractional part of pα and the fractional part of n 2 α are either both O(1/P ), or both are 1 − O(1/P ), or they are at distance O(1/P ) from being symmetrically placed with respect to 1/2.
Another well known conjecture of Hardy and Littlewood states that any large enough odd number is the sum of a prime and 2 times a square.Assuming this conjecture holds true, and applying it to 2m + 1 in a similar way as above, it follows that there is a pair (p, n) such that pα and 2n 2 α are at distance O(1/P ) from being symmetrically placed with respect to α/2 modulo 1. Less famous than the celebrated Goldbach conjecture, this conjecture actually goes back to Goldbach, too.He stated the conjecture in a letter to Euler dated 18 November 1752.For more on the history of this problem, the reader is referred to Hodges [19].
Suppose now that α has a higher Diophantine type, and let b/q be a rational number such that Assume K > 3. Also, assume that both P and N are smaller than q, and do not necessarily satisfy P = N 2 .Now if one tries to find a prime p up to P and a positive integer n up to N such that pα is close to n 2 α modulo 1, then one is actually forced to restrict themselves to only consider pairs (p, n) for which n 2 ≡ p (mod q).Indeed, for any other pair (p, n) the numbers bp and bn 2 are incongruent modulo q, so pb/q and n 2 b/q differ by at least 1/q.On the other hand |pα − pb/q| < P/q K < 1/q K−1 and similarly With K > 3, both the above quantities are much smaller than 1/q.Thus pα − n 2 α ≫ 1/q .By contrast, each pair (p, n) for which n 2 ≡ p (mod q) automatically produces a better result : pα − n 2 α ≪ P + N 2 q K .We end this subsection with the following remark.Notice that one may be able to improve on this bound by studying the distribution of square roots of primes p up to P modulo q.This is directly related to the topic of the present paper.Indeed, a strong bound on the discrepancy of such a set of square roots would imply the existence of such square roots in reasonably short intervals.In particular, it would imply the existence of numbers n N, with N reasonably smaller than q, with n 2 congruent mod q to a prime less than P .This is achieved in Theorem 1.1 above, not for every q, but for most primes q up to Q.There is however no principal obstacle to extending this result to averaging over all integers q Q.Furthermore, using standard tools of the theory of Diophantine approximations, it is easy to show that for any K > 0, for a set of α ∈ [0, 1] of positive Hausdorff dimension, there are infinitely many approximations (2.1) with primes q.
3. Preliminaries 3.1.Notation.Throughout the paper, the notation U = O(V ), U ≪ V and V ≫ U are equivalent to |U| cV for some positive constant c, which throughout the paper may depend on a small real positive parameter ε.
For any quantity V > 1 we write U = V o(1) (as V → ∞) to indicate a function of V which satisfies |U| V ε for any ε > 0, provided V is large enough.
For a sequence of complex weights γ = (γ k ) K k=1 and sigma > 0, we denote For a real A > 0, we write a ∼ A to indicate that a is in the dyadic interval A a < 2A.
We also use (k/q) to denote the Jacobi symbol of k modulo an odd integer q 2. We always use the letter p, with or without subscript, to denote a prime number.
We also use 1 S to denote the characteristic function of a set S and denote by |S| the cardinality of this set.Finally, we recall that * and ♯ mean that the summation is over elements of Z × q and over odd integers, respectively.
3.2.Bilinear forms and equidistribution.Given a, h ∈ Z × q , integer numbers M, N 1 and complex weights we consider bilinear forms in Weyl sums for square roots where, as mentioned above, * means that the summation is over the elements of Z × q .We also remark that the equation x 2 = amn in the definition of the sums (3.1) is considered in Z q and thus is equivalent to the congruence x 2 ≡ amn (mod q).
The goal is to improve the trivial bound For many applications this is especially important ti achieve below the so-called Pólya-Vinogradov range, that is, for M, N q 1/2 , since as it has been shown by Dunn and Zaharescu [11] this leads to a power saving in the error term of an asymptotic formula for a second moment of certain L-functions.
(3.3) Furthermore, in [30] the bounds (3.2) and (3.3) have been improved on average over q where the averaging involves all odd integers q rather than only primes.
Recall that for real positive Q we write q which is the bound of [30] on the sums W a,q (α, β; h, M, N) on average.
More precisely, we now consider the average value where, as before, ♯ means that the summation is over odd integers.By a result of [30], we have Lemma 3.1.For Q → ∞, we have 1) .

3.3.
Distribution of prime quadratic residues on average.We use the following immediate implication of a result of Heath-Brown [17] on the overage values of sums of real characters.
Let N q (P ) be the number of primes p P which are quadratic residues modulo q.Lemma 3.2.Let 1 P Q.Then we have 1) .

Hence (3.8)
q Q q prime N q (P ) − 1 2 π(P ) q Q p P p q .
On the other hand, a very special case of [17, Theorem 1] implies (3.9) q Q q prime p P p q 2 P Q 1+o (1) .
Using the Cauchy inequality, we see that (3.8) and (3.9) imply the desired result.
3.4.Exponential sums and discrepancy.We recall that the discrepancy D(N) of a sequence in ξ 1 , . . ., ξ N ∈ [0, 1) is defined as We remark that this notion of discrepancy is normalized by the presence of the factor 1/N.One may also work with the unnormalized discrepancy, where the factor 1/N is missing from the right side of (3.10).
Thus the normalized discrepancy is bounded by 1, the unnormalized discrepancy is bounded by N, and the connection between them is simply that the unnormalized discrepancy equals N times the normalized discrepancy.
We now recall the classical Erdős-Turán inequality which links the discrepancy and exponential sums (see, for instance, [7,Theorem 1.21] or [22,Theorem 2.5]).Lemma 3.3.Let x n , n ∈ N, be a sequence in [0, 1).Then for any H ∈ N, the discrepancy D N given by (3.10) satisfies It is now useful to recall the definition of the Gauss sum The standard evaluation [21, Theorem 3.3], for odd integer modulus q 3 leads to the formula where ε q = 1 if q ≡ 1 (mod 4) , i if q ≡ −1 (mod 4) .
We also need the following bound for exponential sums over square roots modulo primes.Since below q is always prime, we use the notation of the finite field F q of q elements instead of Z q .Lemma 3.4.For a prime q, an integer W q and integers a and h with gcd(ah, q) = 1, we have e q (hx) ≪ q 1/2+o (1) .
Proof.Completing the exponential sum as in [21,Section 12.2] gives that e q (hx) ≪ max The value t = 0 does not contribute anything and for any t ∈ F × q use (3.11).
4. Proof of Theorem 1.1 4.1.Preliminary discussion.We follow closely the approach of [10], however our estimates are slightly different, so we present the proof in full detail.We recall that in Theorem 1.1 the modulus q runs through primes.Hence we use F q instead of Z q .
As in [10], we see that Lemma 3.3 reduces the discrepancy question to estimating the exponential sum e q (hx) for P q.Thus our goal is to estimate In turn, using partial summation, one can bound the sums S(T, Q) via the sums e q (hx) and, as usual, we use  1) .
In what follows it is convenient to define Hence, recalling (3.7), and using (MN) 1/4 Q −1/4 P 1/4 Q −1/4 ≪ 1 we see that for q ∼ Q we can always use the bound Our main tool is the bound implied by Lemma 3.1 and the Hölder inequality, combined with (4.3).

4.2.
The Heath-Brown identity.To estimate the sum (4.1) we apply the Heath-Brown identity in the form given by [13, Lemma 4.1] (see also [21,Proposition 13.3]) as well as a smooth partition of unity from [12, Lemme 2] (or [13,Lemma 4.3]).We also fix three parameters to be optimised later and define (4.6) J = ⌈log P/ log L⌉ .
We always assume that L exceeds some fixed small power of q so we always have J ≪ 1.Now, as in [13, Lemma 4.3], we decompose S q (h, P ) into a linear combination of O(log 2J q) sums with coefficients bounded by O(log q), is a 2J-tuple of parameters satisfying (4.8) N 1 . . .N J , M 1 , . . ., M J P 1/J , P ≪ R ≪ P (implied constants are allowed to depend on J), with for any fixed ε > 0 satisfy for all integers j 0, where the implied constant may depend on j and ε.
We recall that the notation a ∼ A is equivalent to a ∈ [A/2, 2A).Hence we can rewrite he sum Σ q (V) in the following form In particular, we see that the sums Σ q (V) are supported on a finite set.We now collect various bounds on the sums Σ q (V) which we derive in various ranges of parameters M 1 , . . ., M J , N 1 , . . ., N J until we cover the whole range in (4.7).

4.3.
Bounds of multilinear sums.To estimate the multilinear sums Σ q (V), we put N 1 in ranges which we call "small ", "moderate", "large" and "huge".We further split the "moderate" range in further subranges depending on "small " and "large" values of N 2 .These ranges depend on L, S and U in (4.5) and also P and Q and thus in principle some can be empty depending on the choice of L, S and U.
In order to apply Lemma 3.1, it is convenient to observe that in the bound (4.3) we have M 1/4 Q −1/8 + 1 ≪ 1 for M ≪ Q 1/2 and similarly for the other term involving N. It is also convenient to assume that (4.10) as otherwise the bound of Theorem 1.1 is trivial.
Case I: Small N 1 .
First we consider the case when (4.11) From the definition of J in (4.6) and the condition (4.8) we see that (4.12) M 1 , . . ., M J L .
We see that if (4.11) holds then we can choose two arbitrary sets I, J ⊆ {1, . . ., J} such that for where R is given by (4.9) we have (4.13) Indeed, we simply start multiplying consecutive elements of the sequence M 1 , . . ., M J , N 1 , . . ., N J until their product R + exceeds P 1/2 while the previous product R − < P 1/2 .Since by (4.11) and (4.12) each factor is at most L, we have R + < LR − .Hence • either we have P 1/2 R + P 1/2 L 1/2 and then we set M = R/R + and N = R + ; • or we have P 1/2 > R − > L −1/2 P 1/2 and then we set M = R − and N = R/R − , where R is given by (4.9).
Hence in either case the corresponding N satisfies the upper bound in (4.13).In this case, since for N ≫ P 1/2 we have M ≪ P/N ≪ P 1/2 ≪ Q 1/2 , recalling (4.3), we have Case II: Moderate N 1 .We now consider the case where we now assume that (4.16) S P 1/2 .
We further split it into two subcases, depending on the size of N 2 .
If we have S N 1 L > N 2 , then we again start multiplying N 1 by other elements from the sequence M 1 , . . ., M J , N 2 , . . ., N J and using that (4.10) guarantees that in this range, using (4.16), we have we can prepare some integers M and N with (4.13).Therefore, we again have the bound (4.14).
• Subcase II.2: Moderate N 1 and N 2 .It remains to consider the case when In this case, we define M and N as thus we have S 2 N L 2 .We also note that Hence, the bound (4.3), implies 1) .(4.17) We now observe that (4.17) is trivial when (4.16) fails, so do not have to restrict S to (4.16) anymore.Case III: Large N 1 .In the case when (4.18) U N 1 S we set With the above choice, under the condition (4.18), we have the bounds Therefore, we see that the bound (4.3) implies Case IV: Huge N 1 .We now consider the case when (4.20) U < N 1 P .
We now note that under the condition (4.10) we have Therefore the bound (4.24) implies that (4.25) |Σ q (V)| ρ q P 11/12 + P 4/5 Q 1/10 Q o (1)   for all data V) and hence we obtain (4.2).T λ,q (P ; X, Y ) − 2X q N q (P ) P 11/12 + P 4/5 Q 1/10 Q o(1) , (4.26) where N q (P ) is as in Section 3.3, that is, the number of primes p P which are quadratic residues modulo q.Note that each prime counted by N q (P ) contributes two values of x.
Together with Lemma 3.2, the bound (4.26) concludes the proof.

Possible generalisations
It is natural to ask whether our results and methods can be used to treat higher degree roots of primes, that is, to ask about the distribution of roots of congruences x d ≡ p (mod q), p ∈ R q (P ) , with an integer d 3.
To address this question, we recall that one of the crucial ingredients in the proof of Theorem 1.1 is a result of Heath-Brown [17] on average values of sums of real characters.Similar, albeit weaker, results are also known for cubic and quartic characters, see [2,15,18], however we are unaware of any result for higher order characters.This can limit the abilities of what one can realistically hope to prove nowadays to d 4, unless one assumes the Generalised Riemann Hypothesis, which instantly gives such a necessary result for each q (without any need for averaging), see [21,Sections 5.8 and 5.9].
The second ingredient is provided by bounds of bilinear sums with roots which in turn is based on bounds on the additive energy of roots.The case of square-roots allows a special treatment, see [10,30], however higher degree roots can be studied as well.To illustrate this we consider the congruence with cubic roots (5.1) x + y ≡ a (mod q), x 3 , y 3 ∈ [1, N] , where the cubes are computed modulo q.From (5.1) we derive a 3 ≡ (x + y) 3 = x 3 + y 3 + 3axy (mod q) and then 27a 3 x 3 y 3 ≡ a 3 − x 3 − y 3 3 (mod q) .
Denoting U = x 3 y 3 and V = x 3 + y 3 we arrive to the congruence to which, provided N 2 = o(p), the methods of [3,4] can be applied.Quite to the contrary to above limitation d 4, we believe that this part can be extended to arbitrary d 2.