Maths Olympiad Prep

Library / /610 of 860

Number theory Difficulty 5.3 AIME, harder Find the answer

For odd primes pp, let f(p)f(p) denote the smallest positive integer aa for which there does not exist an integer nn satisfying pn2ap \mid n^{2}-a. Estimate NN, the sum of f(p)2f(p)^{2} over the first 10510^{5} odd primes pp. An estimate of E>0E>0 will receive 22min(N/E,E/N)3\left\lfloor 22 \min (N / E, E / N)^{3}\right\rfloor points.

A number or a short expression. Spacing and $ signs are ignored.

Solution

Note that the smallest quadratic nonresidue aa is always a prime, because if a=bca=b c with b,c>1b, c>1 then one of bb and cc is also a quadratic nonresidue. We apply the following heuristic: if p1p_{1}, p2,p_{2}, \ldots are the primes in increasing order, then given a "uniform random prime" qq, the values of (p1q),(p2q),\left(\frac{p_{1}}{q}\right),\left(\frac{p_{2}}{q}\right), \ldots are independent and are 1 with probability 12\frac{1}{2} and -1 with probability 12\frac{1}{2}. Of course, there is no such thing as a uniform random prime. More rigorously, for any nn, the joint distributions of (p1q),,(pnq)\left(\frac{p_{1}}{q}\right), \ldots,\left(\frac{p_{n}}{q}\right) where qq is a uniform random prime less than NN converges in distribution to nn independent coin flips between 1 and -1 as NN \rightarrow \infty. 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 q<Nq<N and sending NN \rightarrow \infty. Given any nn, the residue of qmodnq \bmod n is uniform over the φ(n)\varphi(n) residues modn\bmod n that are relatively prime to nn. By quadratic reciprocity, conditioned on either q1(mod4)q \equiv 1(\bmod 4) or q3(mod4)q \equiv 3(\bmod 4), exactly half of the nonzero residues modpn\bmod p_{n} satisfy (pnq)=1\left(\frac{p_{n}}{q}\right)=1 and exactly half satisfy (pnq)=1\left(\frac{p_{n}}{q}\right)=-1 for odd pnp_{n} (the case of pn=2p_{n}=2 is slightly different and one must look mod 8, but the result is the same). The residue of qmod8,p2,p3,,pnq \bmod 8, p_{2}, p_{3}, \ldots, p_{n} 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 f(p)2f(p)^{2} as n=1pn22n\sum_{n=1}^{\infty} \frac{p_{n}^{2}}{2^{n}}. Looking at the first few terms gives us 222+324+528+7216+11232+13264+172128+192256+232512+292102422\frac{2^{2}}{2}+\frac{3^{2}}{4}+\frac{5^{2}}{8}+\frac{7^{2}}{16}+\frac{11^{2}}{32}+\frac{13^{2}}{64}+\frac{17^{2}}{128}+\frac{19^{2}}{256}+\frac{23^{2}}{512}+\frac{29^{2}}{1024} \approx 22. The terms after this decay rapidly, so a good approximation is E=22105E=22 \cdot 10^{5}, good enough for 20 points. The more inaccurate E=20105E=20 \cdot 10^{5} 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 NN \rightarrow \infty, the average value of f(p)f(p) over odd primes p<Np<N will converge to n=1pn2n3.675\sum_{n=1}^{\infty} \frac{p_{n}}{2^{n}} \approx 3.675.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: Omni-MATH, licensed Apache-2.0. Statement and solution reproduced as published; topic and difficulty added by this site.