Equidistribution from the Chinese Remainder Theorem

We prove the equidistribution of subsets of $(\Rr/\Zz)^n$ defined by fractional parts of subsets of~$(\Zz/q\Zz)^n$ which are constructed using the Chinese Remainder Theorem.


Introduction
Given an irreducible quadratic polynomial f ∈ Z[X], the celebrated work of Duke, Friedlander, and Iwaniec [2] (see also Toth [14]) shows that the roots of the congruence f (x) ≡ 0 (mod p) become equidistributed when taken over all primes p P. Precisely, their results establish the equidistribution in R/Z of the points x p /p taken over all p P and roots x p of f (x p ) ≡ 0 (mod p). A similar result is expected for roots of polynomials of higher degree, but this remains an outstanding open problem. In [8], Hooley established that if one considers instead the roots of a polynomial congruence (mod n) over all integer moduli n, then a suitable equidistribution result holds. In this paper we show that Hooley's result may be recast as a general fact concerning the equidistribution of sets arising from the Chinese Remainder Theorem. Our work was partly motivated by the paper [5] of Granville and Kurlberg (who consider the spacing between elements of "large" sets defined by the Chinese Remainder Theorem). Some applications were also suggested by recent work of Hrushovski [9].
For simplicity, we begin by considering equidistribution in R/Z; later we shall discuss the higher dimensional case of points in (R/Z) n . Suppose that for each prime number p we are given a set A p of residue classes modulo p. Let ̺(p) = |A p |. We allow for the possibility that ̺(p) = 0, so that A p is empty, for some primes p. For a squarefree integer q, let A q ⊂ Z/qZ denote the set of residue classes x (mod q) such that x (mod p) ∈ A p for all primes p dividing q. These are the "sets defined using the Chinese Remainder Theorem." Let ̺(q) = |A q |, so that ̺(q) is a multiplicative function: We confine ourselves to squarefree q, setting ̺(q) = 0 if q is not squarefree.
Let Q denote the set of all q with ̺(q) 1, and for any integer k 1, let Q k denote the elements of Q with exactly k prime factors. Further, for x 1, let Q(x) (resp. Q k (x)) denote the subset of elements of Q (resp. of Q k ) that are x. In order to ensure that the sets Q and Q k are well behaved and have plenty of elements we shall make the following assumption.
Throughout we operate under Assumption 1.1, and the parameter x will be considered to be large in terms of α and x 0 , so that for example we would have α log log x √ log log x.
Given q ∈ Q, we define a probability measure ∆ q on R/Z by where δ t denotes a Dirac mass at the point t, and {·} denotes the fractional part of a real number. The limiting behavior of such measures is the object of our study. For example, we are interested in knowing whether ∆ q tends to the uniform measure for most q ∈ Q. To quantify whether ∆ q is close to uniform, we use the discrepancy disc(∆ q ) = sup where the supremum is taken over all intervals I in R/Z, and |I| denotes the length of the interval I. By an interval in R/Z we mean the image in R/Z of an interval in R of length at most 1. One has 0 disc(∆ q ) 1 for all q, and a small value of disc(∆ q ) indicates that ∆ q is close to uniform. If we write p x ̺(p) 2 1 p = P, then Theorem 1.2 guarantees that apart from at most Cα −1 |Q(x)|e −P/12 values of q, one has disc(∆ q ) e −P/12 . Thus if P is large then for almost all q x with q ∈ Q one has equidistribution of the sets A q (by which we mean the equidistribution of the measures ∆ q ). Apart from constants, this result is best possible, for we should expect that about e −P |Q(x)| elements q ∈ Q with q x would be divisible by no prime p with ̺(p) 2, and for such q we would have |A q | = 1 and disc(∆ q ) = 1. Theorem 1.2 applies to Hooley's result on roots of a polynomial modulo all (squarefree) integers. By the Chebotarev Density Theorem, any irreducible polynomial of degree d 2 has d roots modulo p for a positive density of primes, so that Assumption 1.1 holds, and further We shall give further applications along these lines in Section 2. Our version is somewhat different from Hooley's, and we shall compare and contrast these in Section 2.2. As the generality of Theorem 1.2 indicates, Hooley's equidistribution [8] is a manifestation of the mixing properties of the Chinese Remainder Theorem rather than the arithmetic structure of roots of polynomial congruences.
We shall generalize and strengthen Theorem 1.2 in a few different ways. Firstly, we consider subsets of (Z/pZ) n for fixed n 1. Here a key issue is to find the correct generalization of the condition that ̺(p) 2 for many primes that arose naturally in the one dimensional case. Secondly, we shall consider equidistribution of the measures ∆ q when q is restricted to integers in Q with exactly k prime factors. Under mild hypotheses on ̺(p), we shall show that in a wide range of k, the discrepancy of the measures ∆ q is typically small. Under more restrictive hypotheses (when ̺(p) is large for p ∈ Q) we show that disc(∆ q ) is typically small already for numbers with two prime factors.
We begin by introducing the higher dimensional setting, and formulating an analogue of Theorem 1.2. Throughout, the dimension n will be considered fixed, so that implicit constants will be allowed to depend on n, but we shall display the dependencies on all other parameters. For each prime number p, let A p ⊂ (Z/pZ) n be a set of residue classes modulo p. As before, we put ̺(p) = |A p | and permit A p to be the empty set (so that ̺(p) = 0) for some primes. For a squarefree integer q, we let A q ⊂ (Z/qZ) n be the set of residue classes x (mod q) such that x (mod p) ∈ A p for all primes p dividing q. Let ̺(q) denote the size of A q , which again is a multiplicative function. As before, we put ̺(q) = 0 when q is not squarefree. We let Q, Q(x), Q k , and Q k (x) have their earlier meanings, and will be working as before under Assumption 1.1.
For a = (a 1 , . . . , a n ) ∈ R n , we write We define a probability measure ∆ q on (R/Z) n by The closeness of ∆ q to the uniform measure is quantified by means of the (box) discrepancy where the supremum is taken over all boxes B in (R/Z) n , and Vol(B) denotes the usual volume (Lebesgue measure) of the box. Here, by a box in (R/Z) n , we mean the projection modulo Z n of a box (that is, a product of intervals) in R n with all side lengths 1. Suppose there is a fixed affine hyperplane H defined over Z such that the elements in A p all lie in the reduction of H modulo p for all p ∈ Q. Then for q ∈ Q, the elements in A q would also lie in this hyperplane, so that the measures ∆ q will be supported in a translate of a proper subtorus of (R/Z) n . This situation prevents equidistribution; it generalizes the case n = 1, where an affine hyperplanes is a single point, so that concentration in a single hyperplane corresponds to the case when ̺(p) 1 for most primes p. Our generalization of Theorem 1.2 establishes that if the sets A p do not concentrate on hyperplanes for a positive density of primes p, then ∆ q is close to the uniform measure (i.e., has small discrepancy) for most moduli q.
To state this precisely, we need one further definition. Given a prime p in Q, define λ(p) = max H⊂(Z/pZ) n H affine hyperplane |H ∩ A p |, and extend λ to Q by multiplicativity. Thus, by the Chinese Remainder Theorem, we have for q ∈ Q, where an affine hyperplace H ⊂ (Z/qZ) n is a subset of the form for some a ∈ Z/qZ and (h i ) ∈ (Z/qZ) n \ {(0, . . . , 0)}. Theorem 1.3. Suppose that Assumption 1.1 holds, and that x is large in terms of α and x 0 . Then, there is a constant C(n) depending only on n such that Consider the case n = 1, where λ(p) = 1 whenever ̺(p) 1. Thus and Theorem 1.2 is seen to be a special case of Theorem 1.3. For any n, given at most n points in (Z/pZ) n , we may always find an affine hyperplane containing all of them. But given n + 1 points we may expect that they are "in general position", in the sense that there is no affine hyperplane that contains all of them. Thus, roughly speaking, Theorem 1.3 says that if there are many primes p with A p in general position, and containing at least n + 1 elements, then for almost all q ∈ Q, the measures ∆ q are close to equidistribution.
By imposing a stronger (but still mild) hypothesis, we can obtain equidistribution of ∆ q on average, when q is restricted to integers with a given number of prime factors. Theorem 1.4. Suppose that Assumption 1.1 holds, and that x is large in terms of x 0 and α. Suppose that 0 < δ 1 is such that Then uniformly in the range 20(6 + n) δ log 20(6 + n) δ k exp αδ log log x 20(6 + n) If we think of δ as a fixed positive constant, then Theorem 1.4 shows that for most q ∈ Q k (x) one has equidistribution of ∆ q so long as k → ∞ (arbitrarily slowly with x) and provided k exp(c √ log log x) for some c > 0. A condition like k → ∞ is necessary to guarantee that A q has many points, which is essential for equidistribution. There is room to improve the upper bound on k, but note that a "typical" integer in Q has on the order of log log x prime factors, so that larger values of k occur very rarely.
Our last result provides equidistribution for ∆ q for most q in Q k , for any fixed k 2, provided the sets A p are known to be large for most p ∈ Q. Theorem 1.5. Suppose that Assumption 1.1 holds, and that x is large in terms of x 0 and α. Let δ > 0 be such that 1/ log log x δ 1/e and Then, uniformly in the range 2 k αδ log log x, The interest in Theorem 1.5 is really for small values of k, since when k is large one may simply use the bounds in Theorem 1.4. If δ in Theorem 1.5 is close to 0, then we get equidistribution for most ∆ q already for integers q with 2 prime factors. For example, this applies whenever ̺(p) tends to infinity for p ∈ Q.
Outline of the paper. The next section provides a selection of applications of Theorem 1.3, and compares the results with those of [8]. Section 3 discusses some preliminaries, and the proof of Theorem 1.3 (which contains Theorem 1.2 as a special case) is concluded in Section 4. In Section 5 we develop a technical estimate (Proposition 5.1) which is more precise (but more complicated to state) than Theorems 1.4 and 1.5, and in Section 6 we prove them starting from that technical result. Finally, Section 7 discusses briefly some other generalizations of our setting, and an Appendix considers a function field analogue of conjectures about roots of polynomials congruences modulo primes.

Examples and counterexamples
In this section, we present some examples of applications of Theorem 1.3, and we discuss the relation of our work with [8].
Applications of Theorem 1.3 are perhaps most interesting when the sets A q can be described globally without reference to the Chinese Remainder Theorem or the prime factorization of q. For example, A q could be the set of solutions of certain equations (e.g., roots of a fixed polynomial with integral coefficients), or the set of parameters where a family of 5 equations has a solution (e.g, the set of squares modulo q), or combinations of these. Or, for example, one may restrict the values q to be the norms of ideals in a given number field K.

2.1.
Variations on roots of polynomial congruences. We begin with an application of Theorem 1.3 to roots of polynomials. This gives a higher dimensional version of Hooley's result, and is motivated by a question of Hrushovski [9, Conjecture 4.1].
be a polynomial with d distinct complex roots. For each prime p, let A p denote the subset of (Z/pZ) d−1 consisting of points (a, a 2 , . . . , a d−1 ) where a runs over the roots of f (x) ≡ 0 (mod p). Then, with the natural meanings of q, Q, ∆ q , for large x we have Proof. Let K f denote the splitting field of f over Q, which has degree [K f : Q] d!. If a large prime p splits completely in K f , then there are d distinct solutions to the congruence f (x) ≡ 0 (mod p), so that ̺(p) = d for such primes. Further, by the Chebotarev density theorem the proportion of primes that split completely in K f is 1/[K f : Q] 1/d!, so that Assumption 1.1 holds. Finally, any affine hyperplane in (Z/pZ) d−1 can intersect the curve (t, t 2 , . . . , t d−1 ) in at most d − 1 points. Thus λ(p) d − 1, and we conclude that The result now follows from Theorem 1.3.
Stated qualitatively, Theorem 2.1 implies that the measures 1 converge to the uniform measure as x → ∞. Indeed Theorem 2.1 implies a quantitative "mod q" version of [9, Conjecture 4.1]; this conjecture is related to the axiomatization (in the setting of continuous first-order logic) of the theory of finite prime fields with an additive character. In the remarks below we mention a few other related applications that may be either deduced qualitatively from Theorem (2.1), or established in a quantitative form by adapting the same argument.
Example 1. By ignoring all but the first coordinate, it is clear that the equidistribution of { a q , a 2 q , . . . , a d−1 q } implies the equidistribution of the first coordinate a q . Let f ∈ Z[X] be a polynomial with d 2 distinct complex roots, and let A p denote the subset of Z/pZ consisting of the points a with f (a) ≡ 0 (mod p). In this 1 dimensional case we may take λ(p) = 1. Then, with the usual meanings of Q, ∆ q , we have for large This is a version of Hooley's result, and we shall discuss the differences from his formulation in the next section. Note that f does not have to be irreducible, but merely have at least 2 distinct complex roots. The case of reducible quadratic polynomials was discussed earlier in [13].
have d distinct complex roots, and let g ∈ Z[X] be a nonconstant polynomial of degree < d. For each prime p let A p denote the set of residue classes g(a) (mod p) where a is a root of f (x) ≡ 0 (mod p). Let A q , Q, ∆ q have their usual meanings. As we saw in the proof of Theorem 2.1 for a density of primes at least 1/d!, the congruence f (x) ≡ 0 (mod p) has d roots. Since g is non-constant and has degree d − 1, for such primes p we see that A p has at least 2 elements. Therefore, we obtain using Theorem 1.
In other words, for most q ∈ Q, the points g(a) (mod q) get equidistributed.
To give another variant, suppose now that g ∈ Z[X] has degree at least 2 but at most d−1, and let now A p denote the set of points (a, g(a)) ∈ (Z/pZ) 2 where f (a) ≡ 0 (mod p). The intersection of A p with any affine hyperplane has at most d − 1 points, and so an application of Theorem 1.3 shows that here 1 Example 3. Here is (essentially) a reformulation of the previous example. Let f and g be two polynomials in Z[X] with degrees d 1 and d 2 respectively. Assume that f • g has d distinct complex roots with d > d 2 . Take A p to be the set of residue classes a (mod p) such that f (a) ≡ 0 (mod p), and such that a ≡ g(b) (mod p) is a value of the polynomial g. This fits the framework of Example 2, by noting that b is a root of f • g (mod p) and then a is just the value g(b). Thus, we obtain the equidistribution (mod q) of those roots of a polynomial f that are constrained to be in the image of a polynomial g.
Example 4. We now consider extensions of Theorem 2.1, where the moduli q are restricted to the integers all of whose prime factors lie in a prescribed set P. That is, given f ∈ Z[X] with at least 2 distinct complex roots, we take A p = ∅ if p / ∈ P and when p ∈ P take A p to be the points (a, a 2 , . . . , a d−1 ) ∈ (Z/pZ) d−1 where a is a root of f (mod p). Or, as in Example 1, we could consider the one dimensional situation of A p being the roots of f (mod p) for p ∈ P. We now give a couple of examples of such analogues of Theorem 2.1.
Let K/Q be a Galois extension, and let P denote the set of primes that are the norm of a principal ideal in K. This means that the primes in P are those that are completely split in H K , the Hilbert class field of K. The set P ′ of primes that are completely split in the compositum H K K f (with K f the splitting field of f ) form a subset of P and if p ∈ P ′ then f ≡ 0 (mod p) has d roots. The Chebotarev density theorem shows that P ′ has positive density. Thus for some constant δ(K, f ) > 0 and all large x. Theorem 1.3 now gives the equidistribution of A q for most moduli q for which f ≡ 0 (mod q) has a root, and when the prime factors of q are constrained to the set P. For example, this applies to P being the set of primes of the form x 2 + my 2 for some natural number m. To give a complementary example, suppose K/Q is a Galois extension (with K = Q) that is linearly disjoint from K f , and take P to be the set of primes that are not norms of ideals in K. Since K and K f are linearly disjoint, the Galois group of the compositum KK f is isomorphic to G × G f . There is a positive density of primes p such that the Frobenius at p is trivial in G f , so that ̺ f (p) = d 2 (if p ∤ D), but non-trivial in G (since |G| 2). Then p is not the norm of an ideal of Z K , so p ∈ P. Now we may apply Theorem 1.3 as usual.

2.2.
Hooley's measures. We now compare our results with the precise statement of [8]. If f is a fixed primitive irreducible polynomial in Z[X] with degree at least 2, then Hooley [8] showed that the probability measures converge, as x → +∞, to the uniform measure on R/Z. Here denotes a normalizing factor, which is asymptotically C f x for a positive constant C f . Hooley's measures are not the same as the measures do not converge to the uniform measure as x → +∞.
Lemma 2.3. Let g denote the multiplicative function defined on squarefree integers q by setting g(p) = 0 for p e 2 , and g(p) = ⌊p/ log p⌋ for p > e 2 . Then there is an absolute constant C such that for all large x Proof. Since p x g(p) ≫ x 2 /(log x) 2 , the lemma amounts to proving the bound If q is a squarefree integer only divisible by primes > e 2 , then a simple induction on the number of prime factors of q shows that p|q log p log q.
Consequently, if q can be factored q = q 1 q 2 with q i > q 1/10 , then Thus the contributions of such integers q x to the left-hand side of (4) is The contribution of q with q x 9/10 is also of smaller order of magnitude.
It remains to consider the contribution of integers x 9/10 q x that cannot be factored as q 1 q 2 with x 1/5 q i x 4/5 . Note that such q must have largest prime factor at least x 1/20 , else a greedy procedure would produce a factorization of q with both factors large. Thus the remaining integers x 9/10 q x may be written as pq 1 with p > x 1/20 and their contribution is since the Euler product over all primes converges. This concludes the proof of (4), and the lemma.
Proof of Proposition 2.2. For p > e 2 take A p to be the set of residue classes k mod p with 1 k g(p), with g as in Lemma 2.3. Here M x = q x g(q), and note that for any ǫ > 0 if p > e 1/ǫ then all the g(p) points k/p with k ∈ A p land in the interval [0, ǫ]. Therefore, using converge to the uniform measure on R/Z. Since these conditions hold for the set of roots modulo p of a fixed monic polynomial f (where ̺ f (q) deg(f )), this (essentially) recovers [8,Th. 2]. 1 (2) For some precise computations of Weyl sums (relative to Hooley's measures) for some reducible polynomials, see the work of Dartyge and Martin [1].

2.3.
Equidistribution of Bezout points. Let n 2 be fixed, and let X 1 and X 2 be two reduced closed subschemes of A n /Z. Assume that the generic fiber of X 1 is a geometrically connected curve over Q, of degree d 1 , and that the generic fiber of X 2 is a geometrically connected hypersurface of degree d 2 . (Concretely, X 2 is the zero set of an absolutely irreducible integral polynomial with n variables, and X 1 could be given by n − 1 "generically transverse" such equations.) Assume that the closures of the generic fibers of X 1 and X 2 in P n /Q intersect transversely. The intersection is then finite by Bezout's Theorem, and has d 1 d 2 geometric points (note that we assume transverse intersection also at infinity). Let k d 1 d 2 be the number of geometric intersection points belonging to the hyperplane at infinity.
For any prime p, let A p = (X 1 ∩ X 2 )(Z/pZ) be the set of Z/pZ-rational intersection points of the curve and the hypersurface. Then, for any q, the set A q is the set of intersection points with coordinates in Z/qZ.
The generic fiber of the intersection variety X 1 ∩ X 2 is defined over Q, and has finitely many geometric points. Let γ be the Galois action of the Galois group of Q on X 1 ∩ X 2 . The fixed field K of the kernel of this action is a finite Galois extension K/Q. If p is totally split in K, then all intersection points are fixed by the Frobenius conjugacy class of K at p, which means that their coordinates belong to Z/pZ. Combining this with Bezout's Theorem, it follows that there exists a set of primes p of positive density such that |A p | = d 1 d 2 − k.
We assume next that d 2 2 and that the curve X 1 is not contained in an affine hyperplane H (this implies that d 1 2, but is a stronger assumption if n 3). Then for any affine hyperplane H ⊂ (Z/pZ) n , we have |A p ∩ H| min(d 1 , d 2 ) so that λ(p) min(d 1 , d 2 ). Hence we conclude from Theorem 1.3 that for most q the fractional parts of the intersection points modulo q become equidistributed in (R/Z) n , provided min(d 1 , d 2 ) < d 1 d 2 − k. As in the case of polynomial congruences, it is natural to ask whether the equidistribution of intersection points holds for prime moduli.
As a concrete example, suppose that X 1 and X 2 are the plane curves given by the equations These curves intersect transversally (including on the line at infinity in P 2 , since they have no common point there), and hence the condition holds since 3 < 9.
where D(n) is the number of derangements (permutations without fixed points) in the symmetric group on n letters. The formula for D(n) is a classical application of inclusionexclusion, and that f 2 is a pseudo-polynomial follows then from [7, Th. 1]). For a pseudo-polynomial f , and a squarefree integer q, take A q to be the zeros of f (mod q); that is, A q is the set of residue classes n (mod q) with f (n) ≡ 0 (mod q). These sets A q are built out of the sets A p for primes p using the Chinese Remainder Theorem. As we have discussed, when f is a genuine polynomial the sets A q get equidistributed for most q. Does Theorem 1.2 also apply generally to pseudo-polynomials? This seems to be a rather challenging question, and we content ourselves with some remarks and numerical experiments concerning the examples of f 1 and f 2 . For computations with f 1 and f 2 , it is efficient to use the recursive definitions Numerical experiments suggest that the values f 1 (n) = ⌊en!⌋ (mod p) for 1 n p behave like p independent random residue classes drawn uniformly from Z/pZ. If so, this suggests that there are k solutions to f 1 (n) ≡ 0 (mod p) for a proportion e −1 /k! of the primes p below x: that is, for any k 0 In other words, the quantity ̺(p) is distributed like a Poisson random variable with parameter 1. If true, this would imply that Theorem 1.2 applies to the zeros of f 1 modulo primes. However, we do not know how to prove that ̺(p) 2 for an infinite set of primes.
The following tables give the empirical and theoretical Poisson distribution for the 78498 primes p x = 10 6 (normalized by multiplying the Poisson probabilities by π(x); no empirical value is larger than 8 in that range), as well as the empirical and theoretical moments of order 1 n 4. Note that if g ∈ Z[X] is an irreducible polynomial of degree n with Galois group S n (the generic case), then the Chebotarev density theorem implies that lim x→+∞ 1 π(x) |{p x | ̺ g (p) = k}| = 1 n! |{π ∈ S n with k fixed points}|.

Empirical and theoretical probability distribution
Now for large n, the number of fixed points of a permutation drawn uniformly at random from S n is distributed approximately like a Poisson random variable with parameter 1. Thus our guess above on the number of zeros of the pseudo-polynomial f 1 (mod p) is akin to what holds for a generic irreducible polynomial of large degree.
For the function f 2 (n) = (−1) n D(n), numerical experiments also suggest that there is a positive density of primes with ̺(p) 2, so that Theorem 1.2 should apply. Once again we are unable to establish such a claim.
But, if we put f 3 (n) = f 2 (n) − 1, then from the recurrence for f 2 given above we may recognize that f 3 (0) = 0, and f 3 (p − 1) ≡ 0 (mod p) for each prime p. Thus in this case ̺(p) 2 for each prime p, and Theorem 1.2 applies. Now |f 3 (n)| has a combinatorial meaning: it equals the number of permutations in S n with exactly one fixed point. Since |f 3 | and f 3 have the same zeros (mod q) for any q, we see that Theorem 1.2 applies to the combinatorial sequence |f 3 (n)|.

Preliminaries
Throughout we work in the higher dimensional framework of Theorems 1.3, 1.4, 1.5, so that A p is a subset of (Z/pZ) n , and ̺(p) is its cardinality. We keep in place Assumption 1.1, and have in mind that x is large in comparison to α and x 0 .
3.1. The sets Q and Q k . We begin by gaining an understanding of the size of the sets Q(x) and Q k (x) (of elements in Q with exactly k prime factors). Proof. Observe that Using Assumption 1.1, it follows for large x that Now put z = x 1/9 and τ = 1/ log z, and note that Assembling the above observations together we conclude that The lemma follows since We can also prove a matching upper bound for |Q(x)|, and in fact will need a such a bound for the smooth (or friable) elements in Q(x). Lemma 3.2. Let x be large, and z be a parameter with log x z x. Then Proof. We start by noting that where ℓ denotes a prime number. The term √ x is much smaller than the estimate we desire, and so we may ignore it and focus on the second term above. Using the prime number theorem, Now for any τ ∈ [0, 1] we may bound min(x/d, z) (x/d) 1−τ z τ . Using this observation with τ = 1/ log z, we obtain The lemma follows upon noting that The next two lemmas will be analogues of the above for the sets Q k (x) for a given integer k 1. Readers who are mostly interested in Theorems 1.2 and 1.3 may skip at this point to Section 3.2 Define The added constant 2 in (5) is unimportant, but will be convenient later.
where the implied constant is absolute.
Proof. We obtain a lower bound by counting only those elements of Q k ∩ [1, x] that are of the form p 1 · · · p k , where the primes p j are in ascending order and satisfy p 1 , . . . , p k−1 x 1/(2k) . Fixing these primes p 1 , . . . , p k−1 , we see using Assumption 1.1 that there are at least αx 4p 1 · · · p k−1 log x 14 possible choices for the large prime p k . Therefore Let p 1 , . . . , p k−2 be distinct primes in Q all below x 1/(2k) . Then The quantity 1/p 1 + . . . + 1/p k−2 is at most equal to the corresponding sum when the primes p i are equal to the first k − 2 primes, and hence is log log(k + 1) + O(1), so that for some absolute constant C 0. Repeating this argument, we find the same lower bound for each of the sums over p k−2 , . . ., p 1 , and therefore we obtain the lower bound for x x 0 , where the implied constant is absolute. Since and log k P(x)/4, the lemma follows.
Lemma 3.4. Let x be large. Let k (log x) 1 2 be a positive integer, and κ a non-negative integer with κ k. The number of integers in Q k (x) having at least κ prime factors larger than where the implied constant is absolute.

15
Therefore N x where the variable j represents the number of primes in p 1 , . . ., p k−1 that are larger than x 1/(3k) . Now the sum over j above may be bounded by which establishes the lemma.
(1) For x 1 ∈ Z n and x 2 ∈ Z n , the element of (Z/q 1 q 2 Z) n which is congruent to x i modulo q i is the residue class of the vector (2) Opening the square and interchanging the order of the summations, we find that a (mod q) ah · (x − y) q .

1.
Summing over x first, this gives a (mod q) where α(x) is the number of y ∈ A q such that h · y = h · x (mod q). By multiplicativity, we have α(x) ̺((h, q))λ(q/(h, q)) for all x, and the result follows.
Remark 3.6. Part (1) is the crucial place where we use the fact that A q is defined by the Chinese Remainder Theorem, while (2) is the only point where we detect any cancellation in the Weyl sums W(h; q).

3.3.
The Erdős-Turán inequality. We recall the n-dimensional Erdős-Turán inequality for the discrepancy of ∆ q (see, e.g., [6, Lemma 2] for references): for any integer H 1, we have where h = max(|h i |) and M(h) = i max(1, |h i |) and where the implied constant depends only on n. We now record a consequence of Lemma 3.5 for terms appearing in (9), and then use it to bound certain useful averages of disc(∆ q ).
where we used Lemma 3.1 in the last step. Combining this bound with (10), we obtain Theorem 1.3, hence also Theorem 1.2.

The main technical result
In this section, we establish a general technical estimate, from which the simpler (but less precise) Theorems 1.4 and 1.5 will be deduced in the next section. In addition to P(x) (defined in (5)), we will use the quantity Since λ(p) ̺(p), note that P(x) P(x).
Proposition 5.1. Suppose that Assumption 1.1 holds, and let x be large in terms of α and x 0 .
Put z = x 1/(3k) and factor q ∈ Q k (x) uniquely in the form q = rs, where all prime factors of s are z and all prime factors of r are > z. Below, r and s will always be assumed to have this meaning. Since ω(s) ω(q) = k, we note that s z k = x 1 3 . 20 5.1. When k is small: proof of part (1). In this case k P(x), so that k log k/P(x) log k, and Lemma 3.3, together with Stirling's formula, yields (14) |Q Recall the factorization q = rs and that q has exactly k prime factors. If ω(s) = k then r must be 1, and q = s z k = x 1 3 . Since disc(∆ q ) 1 always, such terms contribute at most x 1 3 . For the remaining terms when ω(s) < k, we apply for each s the bound arising from Lemma 3.8. Thus, for any H 2, We choose here H = (1 + P(x)/ P(x)) k so that for all 0 j k − 1 one has P(x) j /H P(x) j . Noting that (log H) n = k log 1 + P(x) P(x) n ≪ k n P(x) P(x) 1 10 , we conclude that where the term x 1 3 has been absorbed into the much larger quantity displayed above. Suppose first that k 2 P(x) − 1. In the range 0 j k − 1, the quantity P(x) j /j! attains its maximum at some j 0 which lies in the range k − 1 j 0 (k − 1)/2. Note that, since k P(x) P(x) j 0 j 0 ! (k − 1)! P(x) k−1 P(x) j 0 j 0 ! j 0 ! P(x) j 0 P(x) P(x) k−1 2 .

5.2.
When k is large: proof of part (2). Assume that P(x) < k exp( √ log log x). Let κ k/3 be a parameter to be fixed later. For terms q = rs with ω(r) κ, note that disc(∆ q ) 1 trivially, and Lemma 3.4 gives a bound on the number of such terms. Thus where we used the lower bound for |Q k (x)| arising from Lemma 3.3, and the fact that k P(x).
On the other hand, we estimate the contributions of those q for which ω(r) < κ using Lemma 3.8 exactly as in the argument leading up to (16), with the same choice of H as before. Thus q∈Q k (x) ω(r)<κ disc(∆ q ) ≪ k 1+n x log x P(x) P(x) 1 10 k−1 j=k−κ P(x) j j! .
Now for each k − κ j k − 1 note that, since κ k/3,