{
  "id": "6749",
  "ident": "NS.06749",
  "slug": "oeis-69004--conjecture2",
  "title": "Number of times $n^2 + s^2$ is prime for positive integers $s < n$ · conjecture2",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Stronger conjecture: Let pi(n) be the prime counting function (A000720). Then\npi(n) >= a(n) >= pi(n)/5 for n>1, with the following equalities: pi(2)=a(2),\npi(10)=a(10) and a(12)=pi(12)/5.\n- T. D. Noe, Feb 26 2007\n\nThis conjunction is false. The upper bound fails at $n = 512720$:\na Lean certificate proves $a(512720) \\ge 42494 > 42493 = \\pi(512720)$.\nThe counterexample was recorded by j2d9w5xtjn-png [CE26].\n\nLean formalization by Wentao Li, with AI assistance, adapting Epoch Research's\ncertificate attempt; see [Li26].",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA69004.conjecture2",
  "statement_lean": "theorem conjecture2 : ¬ (\n    (∀ n : ℕ, 1 < n → Nat.primeCounting n ≥ a n) ∧\n    (∀ n : ℕ, 1 < n → 5 * a n ≥ Nat.primeCounting n) ∧\n    Nat.primeCounting 2 = a 2 ∧\n    Nat.primeCounting 10 = a 10 ∧\n    5 * a 12 = Nat.primeCounting 12)",
  "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# Number of times $n^2 + s^2$ is prime for positive integers $s < n$\n\nThe sequence $a(n)$ counts the number of integers $s \\in \\{1, \\dots, n-1\\}$ such that\n$n^2 + s^2$ is prime:\n$$a(n) = \\sum_{s=1}^{n-1} [\\text{Prime}(n^2 + s^2)]$$\n\n*References:*\n- [A069004](https://oeis.org/A069004)\n- [CE26] j2d9w5xtjn-png, [Counterexample to the upper bound](https://github.com/google-deepmind/formal-conjectures/pull/5453), 2026.\n- [Li26] Wentao Li, [Lean certificate for the A069004 counterexample](https://github.com/VictorLiwentao/lean-oeis-proofs/blob/a16a2711b082ccab4ba941330148e7b7c78b11c1/proofs/new-formalization/A069004/PROOF.md), 2026.\n-/\n\n@[expose] public section\n\nnamespace OeisA69004\n\nopen Finset\n\n/-- Number of times $n^2 + s^2$ is prime for positive integers $s < n$. -/\ndef a (n : ℕ) : ℕ :=\n  ∑ s ∈ Ico 1 n, if (n ^ 2 + s ^ 2).Prime then 1 else 0\n\n/-- Value of the sequence `a` at 1. -/\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 0 := by\n  decide\n\n/-- Value of the sequence `a` at 2. -/\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 1 := by\n  decide\n\n/-- Value of the sequence `a` at 3. -/\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 1 := by\n  decide\n\n/-- Value of the sequence `a` at 4. -/\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 1 := by\n  decide\n\n/-- Value of the sequence `a` at 5. -/\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 2 := by\n  decide\n\n/--\nConjecture: $a(n) > 0$ for all $n > 1$.-/\n@[category research open, AMS 11]\ntheorem conjecture1 (n : ℕ) (hn : 1 < n) : 0 < a n := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nStronger conjecture: Let pi(n) be the prime counting function (A000720). Then\npi(n) >= a(n) >= pi(n)/5 for n>1, with the following equalities: pi(2)=a(2),\npi(10)=a(10) and a(12)=pi(12)/5.\n- T. D. Noe, Feb 26 2007\n\nThis conjunction is false. The upper bound fails at $n = 512720$:\na Lean certificate proves $a(512720) \\ge 42494 > 42493 = \\pi(512720)$.\nThe counterexample was recorded by j2d9w5xtjn-png [CE26].\n\nLean formalization by Wentao Li, with AI assistance, adapting Epoch Research's\ncertificate attempt; see [Li26].\n-/\n@[category research solved, AMS 11,\n  formal_proof using lean4 at \"https://github.com/VictorLiwentao/lean-oeis-proofs/blob/a16a2711b082ccab4ba941330148e7b7c78b11c1/LeanOeisProofs/NewFormalization/A069004.lean#L58\"]\ntheorem conjecture2 : ¬ (\n    (∀ n : ℕ, 1 < n → Nat.primeCounting n ≥ a n) ∧\n    (∀ n : ℕ, 1 < n → 5 * a n ≥ Nat.primeCounting n) ∧\n    Nat.primeCounting 2 = a 2 ∧\n    Nat.primeCounting 10 = a 10 ∧\n    5 * a 12 = Nat.primeCounting 12) := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nThe upper bound from T. D. Noe's stronger conjecture: \"pi(n) >= a(n)\" for \"n>1\".\nIt is false at $n = 512720$: $a(512720) \\ge 42494 > 42493 = \\pi(512720)$.\nThe counterexample was recorded by j2d9w5xtjn-png [CE26].\n\nLean formalization by Wentao Li, with AI assistance, adapting Epoch Research's\ncertificate attempt; see [Li26].\n-/\n@[category research solved, AMS 11,\n  formal_proof using lean4 at \"https://github.com/VictorLiwentao/lean-oeis-proofs/blob/a16a2711b082ccab4ba941330148e7b7c78b11c1/LeanOeisProofs/NewFormalization/A069004.lean#L49\"]\ntheorem conjecture2.variants.upper_bound_false :\n    ¬ ∀ n : ℕ, 1 < n → Nat.primeCounting n ≥ a n := by\n  sorry\n\n/--\nThe part of the stronger conjecture that survives the counterexample to its upper bound:\n$5 a(n) \\ge \\pi(n)$ for $n > 1$, together with the three claimed equalities\n$\\pi(2) = a(2)$, $\\pi(10) = a(10)$ and $a(12) = \\pi(12)/5$.-/\n@[category research open, AMS 11]\ntheorem conjecture2.variants.without_upper_bound :\n    (∀ n : ℕ, 1 < n → 5 * a n ≥ Nat.primeCounting n) ∧\n    Nat.primeCounting 2 = a 2 ∧\n    Nat.primeCounting 10 = a 10 ∧\n    5 * a 12 = Nat.primeCounting 12 := by\n  sorry\n\nend OeisA69004\n",
  "statement_hash": "941d50aff50018964db3bfb3a0352d5b2e68f1454e3ab24db1a9c449af2fe907",
  "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."
}