/-
Copyright 2026 The Formal Conjectures Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/modulepublicimportFormalConjecturesUtil
$n_k(p)$: the least positive integer which is not a $k$-th power residue modulo $p$. If every
integer is a $k$-th power residue (for example if $\gcd(k, p - 1) = 1$) the value is $0$; this
does not happen for the primes $p \equiv 1 \pmod k$ with $k \geq 2$ used below.
Let $k\geq 2$ and $n_k(p)$ denote the least $k$th power nonresidue of $p$. Is it true that
$$\sum_{p<x} n_k(p)\sim c_k \frac{x}{\log x}$$
for some constant $c_k>0$?
Erdős [Er65b] asked this; it is true, and was proved by Elliott [El67b]. As in [El67b], the sum
is over the primes $p \equiv 1 \pmod k$ (for each of which a $k$th power nonresidue exists).
Erdős [Er61e] proved this when $k=2$, with
$$c_2=\sum_{k=1}^\infty \frac{p_k}{2^k},$$
where $p_k$ is the $k$th prime; the sum is over the odd primes $p < x$ [MaPo11, (1.1)].