{
  "id": "2825",
  "ident": "NS.02825",
  "slug": "erdos-676",
  "title": "Erdős Problem 676",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Is every sufficiently large integer of the form $ap^2+b$ for some prime $p$ and integers\n$a \\geq 1$ and $0 \\leq b < p$?",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos676.erdos_676",
  "statement_lean": "theorem erdos_676 : ∀ᶠ n in atTop,\n    ∃ a p b : ℕ, p.Prime ∧ 1 ≤ a ∧ b < p ∧ n = a * p ^ 2 + b",
  "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-/\n\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Erdős Problem 676\n\n*References:*\n- [erdosproblems.com/676](https://www.erdosproblems.com/676)\n- [Er79] Erdős, Paul, *Some unconventional problems in number theory*.\n  Math. Mag. (1979), 67–70.\n- [Er79d] Erdős, P., *Some unconventional problems in number theory*.\n  Acta Math. Acad. Sci. Hungar. (1979), 71–80.\n- [Er80] Erdős, Paul, *A survey of problems in combinatorial number theory*.\n  Ann. Discrete Math. (1980), 89–115.\n-/\n\n@[expose] public section\n\nnamespace Erdos676\n\nopen Filter\n\n/-- An integer has a representation $ap^2+b$ with $p$ prime, $a \\geq 1$, and $b < p$\nif and only if $p^2 \\leq n$ and $n \\bmod p^2 < p$ for some prime $p$. -/\n@[category test, AMS 11]\ntheorem representation_iff_mod (n : ℕ) :\n    (∃ a p b : ℕ, p.Prime ∧ 1 ≤ a ∧ b < p ∧ n = a * p ^ 2 + b) ↔\n      ∃ p : ℕ, p.Prime ∧ p ^ 2 ≤ n ∧ n % p ^ 2 < p := by\n  constructor\n  · rintro ⟨a, p, b, hp, ha, hb, rfl⟩\n    refine ⟨p, hp, ?_, ?_⟩\n    · nlinarith\n    · have hb' : b < p ^ 2 := by\n        have := hp.two_le\n        nlinarith\n      simpa [Nat.add_mod, Nat.mul_mod, Nat.mod_eq_of_lt hb'] using hb\n  · rintro ⟨p, hp, hn, hr⟩\n    refine ⟨n / p ^ 2, p, n % p ^ 2, hp, ?_, hr, ?_⟩\n    · exact Nat.div_pos hn (pow_pos hp.pos _)\n    · simpa [Nat.mul_comm, Nat.add_comm] using (Nat.mod_add_div n (p ^ 2)).symm\n\n/-- The integer $35$ has no representation $ap^2+b$ of the required form. -/\n@[category test, AMS 11]\ntheorem not_representable_35 :\n    ¬ ∃ a p b : ℕ, p.Prime ∧ 1 ≤ a ∧ b < p ∧ 35 = a * p ^ 2 + b := by\n  rw [representation_iff_mod]\n  rintro ⟨p, hp, hn, hr⟩\n  have hp6 : p < 6 := by nlinarith\n  have hc : ∀ q : Fin 6, ¬ (q.val.Prime ∧ q.val ^ 2 ≤ 35 ∧ 35 % q.val ^ 2 < q.val) :=\n    by decide\n  exact hc ⟨p, hp6⟩ ⟨hp, hn, hr⟩\n\n/-- The integer $899$ has no representation $ap^2+b$ of the required form. -/\n@[category test, AMS 11]\ntheorem not_representable_899 :\n    ¬ ∃ a p b : ℕ, p.Prime ∧ 1 ≤ a ∧ b < p ∧ 899 = a * p ^ 2 + b := by\n  rw [representation_iff_mod]\n  rintro ⟨p, hp, hn, hr⟩\n  have hp30 : p < 30 := by nlinarith\n  have hc : ∀ q : Fin 30, ¬ (q.val.Prime ∧ q.val ^ 2 ≤ 899 ∧ 899 % q.val ^ 2 < q.val) :=\n    by decide\n  exact hc ⟨p, hp30⟩ ⟨hp, hn, hr⟩\n\n/-- Is every sufficiently large integer of the form $ap^2+b$ for some prime $p$ and integers\n$a \\geq 1$ and $0 \\leq b < p$? -/\n@[category research open, question, AMS 11]\ntheorem erdos_676 : ∀ᶠ n in atTop,\n    ∃ a p b : ℕ, p.Prime ∧ 1 ≤ a ∧ b < p ∧ n = a * p ^ 2 + b := by\n  sorry\n\n/- TODO: Formalize the source's additional variants: the quantitative almost-all result, the\nversion without primality, the general pair $(A,f)$, and the questions about the minimal $c_n$. -/\n\nend Erdos676\n",
  "statement_hash": "084b2b68dddb2d47b15f4e80c342d4ad26c9c6032d195701c93136e8dc740bc4",
  "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."
}