Maths Olympiad Prep

Library / /967 of 1394

, 2020

Number theory Difficulty 5.5 AIME, harder Find the answer United States

Problem:

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.

Proposed by: Michael Ren

A number or a short expression. Fractions can be typed as 3/2, and spacing doesn't matter.

Solution

Solution:

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 sympy
print(sum([smallest_nqr(p) 2 for p in sympy.ntheory.primerange(3, sympy.prime(105+2))]))
```

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: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.