{
  "id": "3857",
  "ident": "NS.03857",
  "slug": "erdos-980",
  "title": "Erdős Problem 980",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Let $k\\geq 2$ and $n_k(p)$ denote the least $k$th power nonresidue of $p$. Is it true that\n$$\\sum_{p<x} n_k(p)\\sim c_k \\frac{x}{\\log x}$$\nfor some constant $c_k>0$?\n\nErdős [Er65b] asked this; it is true, and was proved by Elliott [El67b]. As in [El67b], the sum\nis over the primes $p \\equiv 1 \\pmod k$ (for each of which a $k$th power nonresidue exists).",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos980.erdos_980",
  "statement_lean": "theorem erdos_980 (k : ℕ) (hk : 2 ≤ k) :\n    ∃ c > (0 : ℝ), residueSum k ~[atTop] fun x ↦ c * x / Real.log x",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Erdős Problem 980\n\n*References:*\n- [erdosproblems.com/980](https://www.erdosproblems.com/980)\n- [El67b] Elliott, P. D. T. A., *A problem of Erdős concerning power residue sums*.\n  Acta Arith. 13 (1967/68), 131-149.\n- [Er61e] Erdős, P., *Remarks on number theory. I*. Mat. Lapok (1961), 10-17.\n- [Er65b] Erdős, P., *Some recent advances and current problems in number theory*. Lectures on\n  Modern Mathematics, Vol. III (1965), 196-244.\n- [MaPo11] Martin, G. and Pollack, P., *The average least character nonresidue and further\n  variations on a theme of Erdős*. [arXiv:1112.1175](https://arxiv.org/abs/1112.1175) (2011).\n-/\n\n@[expose] public section\n\nopen Filter Asymptotics\n\nnamespace Erdos980\n\n/-- $n_k(p)$: the least positive integer which is not a $k$-th power residue modulo $p$. If every\ninteger is a $k$-th power residue (for example if $\\gcd(k, p - 1) = 1$) the value is $0$; this\ndoes not happen for the primes $p \\equiv 1 \\pmod k$ with $k \\geq 2$ used below. -/\nnoncomputable def leastNonresidue (k p : ℕ) : ℕ :=\n  sInf {n : ℕ | 0 < n ∧ ¬ ∃ x : ZMod p, x ^ k = (n : ZMod p)}\n\n/-- $\\sum n_k(p)$ over the primes $p < x$ with $p \\equiv 1 \\pmod k$. -/\nnoncomputable def residueSum (k : ℕ) (x : ℝ) : ℝ :=\n  ∑ p ∈ (Nat.primesBelow ⌈x⌉₊).filter (fun p ↦ p % k = 1), (leastNonresidue k p : ℝ)\n\n/-- $2$ is the least quadratic nonresidue modulo $3$. -/\n@[category test, AMS 11]\ntheorem leastNonresidue_two_three : leastNonresidue 2 3 = 2 := by\n  have h2 : 2 ∈ {n : ℕ | 0 < n ∧ ¬ ∃ x : ZMod 3, x ^ 2 = (n : ZMod 3)} :=\n    ⟨by norm_num, by decide⟩\n  refine le_antisymm (Nat.sInf_le h2) (le_csInf ⟨2, h2⟩ ?_)\n  rintro n ⟨hn, hn'⟩\n  by_contra! h\n  have h1 : n = 1 := by omega\n  subst h1\n  exact hn' ⟨1, by decide⟩\n\n/--\nLet $k\\geq 2$ and $n_k(p)$ denote the least $k$th power nonresidue of $p$. Is it true that\n$$\\sum_{p<x} n_k(p)\\sim c_k \\frac{x}{\\log x}$$\nfor some constant $c_k>0$?\n\nErdős [Er65b] asked this; it is true, and was proved by Elliott [El67b]. As in [El67b], the sum\nis over the primes $p \\equiv 1 \\pmod k$ (for each of which a $k$th power nonresidue exists).\n-/\n@[category research solved, question, AMS 11]\ntheorem erdos_980 (k : ℕ) (hk : 2 ≤ k) :\n    ∃ c > (0 : ℝ), residueSum k ~[atTop] fun x ↦ c * x / Real.log x := by\n  sorry\n\n/--\nErdős [Er61e] proved this when $k=2$, with\n$$c_2=\\sum_{k=1}^\\infty \\frac{p_k}{2^k},$$\nwhere $p_k$ is the $k$th prime; the sum is over the odd primes $p < x$ [MaPo11, (1.1)].\n-/\n@[category research solved, AMS 11]\ntheorem erdos_980.variants.erdos_two :\n    residueSum 2 ~[atTop]\n      fun x ↦ (∑' i : ℕ, (Nat.nth Nat.Prime i : ℝ) / 2 ^ (i + 1)) * x / Real.log x := by\n  sorry\n\nend Erdos980\n",
  "statement_hash": "b040b1fa34844eb4e13d485fa16c3fe9ea07fa0ac6a34c1937e8950b1349cf07",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}