Solution (source code)

= Solution

For coefficients $b_n$ supported on an interval of length $H$, write $B=\sum b_n$ and $B_p(a)=\sum_{n\equiv a\pmod p}b_n$. The <variance form of the large sieve> states
$$
\sum_{p\leq Q}p\sum_{a\bmod p}|B_p(a)-B/p|^2\ll(H+Q^2)\sum|b_n|^2.
$$
The constant is absolute. One may take the explicit right side $(Q^2+2\pi H)\sum|b_n|^2$, by <orthogonality of roots of unity> and the <exponential-sum large sieve> proved in Question 2.

Take $H=\lfloor N^2\rfloor$, $Q=N$, and $b_n$ the <indicator function> of the $N^\varepsilon$-<smooth numbers> up to $N^2$. Applying the given smooth-number density with parameter $\varepsilon/2$ gives
$$
B\geq\kappa(\varepsilon/2)N^2,
$$
with a harmless adjustment of the constant for integer endpoints. If an <odd prime> $p\leq N$ has <least quadratic nonresidue> $n(p)>N^\varepsilon$, then $p>N^\varepsilon$: a <quadratic nonresidue> always occurs among $1,\ldots,p-1$. Every <prime factor> of every selected <smooth number> is thus a nonzero <quadratic residue> modulo $p$. By the <multiplicativity of the Legendre symbol>, every selected number is a nonzero <quadratic residue> modulo $p$.

There are $(p-1)/2$ nonzero <quadratic nonresidue> classes, and $B_p(a)=0$ on all of them. Their contribution to the variance is at least
$$
p\frac{p-1}{2}\left(\frac Bp\right)^2
=\frac{p-1}{2p}B^2\geq\frac13B^2.
$$
If $R$ denotes the number of exceptional <primes>, the <variance form of the large sieve>, with $\sum|b_n|^2=B$, yields $RB^2\ll N^2B$. Consequently
$$
\boxed{R\ll\frac{N^2}{B}\ll\kappa(\varepsilon/2)^{-1}=O_\varepsilon(1).}
$$
This is the <bounded exceptional primes for least quadratic nonresidues> argument. Using an interval of length $N^2$ is what matches the $Q^2$ term; an interval of length $N$ would not give a bounded exceptional set.