For odd primes , let denote the smallest positive integer for which there does not exist an integer satisfying . Estimate , the sum of over the first odd primes . An estimate of will receive points.
Solution
Note that the smallest quadratic nonresidue is always a prime, because if with then one of and is also a quadratic nonresidue. We apply the following heuristic: if , are the primes in increasing order, then given a "uniform random prime" , the values of are independent and are 1 with probability and -1 with probability . Of course, there is no such thing as a uniform random prime. More rigorously, for any , the joint distributions of where is a uniform random prime less than converges in distribution to independent coin flips between 1 and -1 as . For ease of explanation, we won't adopt this more formal view, but it is possible to make the following argument rigorous by looking at primes and sending . Given any , the residue of is uniform over the residues that are relatively prime to . By quadratic reciprocity, conditioned on either or , exactly half of the nonzero residues satisfy and exactly half satisfy for odd (the case of is slightly different and one must look mod 8, but the result is the same). The residue of are independent as these are pairwise relatively prime, yielding our heuristic. Thus, we may model our problem of finding the smallest quadratic nonresidue with the following process: independent fair coins are flipped for each prime, and we take the smallest prime that flipped heads. We can estimate the expected value of as . Looking at the first few terms gives us . The terms after this decay rapidly, so a good approximation is , good enough for 20 points. The more inaccurate earns 15 points. This Python code computes the exact answer: ``` def smallest_nqr(p): for a in range(1,p): if pow(a, (p-1)//2,p)==p-1: return a ```import sympyprint(sum([smallest_nqr(p)2 for p in sympy.ntheory.primerange(3,sympy.prime(105+2))])) Remark. In 1961, Erdős showed that as , the average value of over odd primes will converge to .