{
  "id": "5788",
  "ident": "NS.05788",
  "slug": "oeis-238585",
  "title": "Number of primes $p < n$ with $\\text{prime}(p)^2 + (\\text{prime}(n) - 1)^2$ prime",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Conjecture (i): $a(n) > 0$ unless $n$ divides $6$.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA238585.conjecture_1",
  "statement_lean": "theorem conjecture_1 (n : ℕ) (hn : 0 < n) :\n    0 < a n ↔ ¬(n ∣ 6)",
  "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 primes $p < n$ with $\\text{prime}(p)^2 + (\\text{prime}(n) - 1)^2$ prime\n\nThe sequence $a(n)$ counts the number of primes $p < n$ such that\n$\\text{prime}(p)^2 + (\\text{prime}(n) - 1)^2$ is prime, where $\\text{prime}(i)$ denotes the\n$i$-th prime number (1-indexed).\n\n*References:*\n- [A238585](https://oeis.org/A238585)\n- [Problems on combinatorial properties of primes](https://arxiv.org/abs/1402.6641)\n  by *Zhi-Wei Sun* (2014)\n-/\n\n@[expose] public section\n\nnamespace OeisA238585\n\nopen Finset\n\n/-- Number of primes $p < n$ with $\\text{prime}(p)^2 + (\\text{prime}(n) - 1)^2$ prime. -/\nnoncomputable def a (n : ℕ) : ℕ :=\n  ∑ p ∈ Ico 1 n,\n    if p.Prime ∧ Nat.Prime (Nat.nth Nat.Prime (p - 1) ^ 2 + (Nat.nth Nat.Prime (n - 1) - 1) ^ 2)\n    then 1 else 0\n\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 0 := by\n  simp [a]\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 0 := by\n  simp only [a, show Ico 1 2 = {1} by decide, Finset.sum_singleton]\n  decide\n\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 0 := by\n  simp only [a, show Ico 1 3 = {1, 2} by decide,\n    Finset.sum_insert (by decide : 1 ∉ ({2} : Finset ℕ)),\n    Finset.sum_singleton, Nat.reduceSub, Nat.nth_prime_one_eq_three, Nat.nth_prime_two_eq_five]\n  decide\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 1 := by\n  simp only [a, show Ico 1 4 = {1, 2, 3} by decide,\n    Finset.sum_insert (by decide : 1 ∉ ({2, 3} : Finset ℕ)),\n    Finset.sum_insert (by decide : 2 ∉ ({3} : Finset ℕ)),\n    Finset.sum_singleton, Nat.reduceSub, Nat.nth_prime_one_eq_three, Nat.nth_prime_two_eq_five,\n    Nat.nth_prime_three_eq_seven]\n  decide\n\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 1 := by\n  simp only [a, show Ico 1 5 = {1, 2, 3, 4} by decide,\n    Finset.sum_insert (by decide : 1 ∉ ({2, 3, 4} : Finset ℕ)),\n    Finset.sum_insert (by decide : 2 ∉ ({3, 4} : Finset ℕ)),\n    Finset.sum_insert (by decide : 3 ∉ ({4} : Finset ℕ)),\n    Finset.sum_singleton, Nat.reduceSub, Nat.nth_prime_one_eq_three, Nat.nth_prime_two_eq_five,\n    Nat.nth_prime_four_eq_eleven]\n  decide\n\nset_option maxRecDepth 4000 in\n@[category test, AMS 11]\ntheorem a_8 : a 8 = 2 := by\n  have hIco : Ico 1 8 = {1, 2, 3, 4, 5, 6, 7} := by decide\n  simp only [a, hIco, Finset.sum_insert, Finset.mem_insert, Finset.mem_singleton,\n    OfNat.one_ne_ofNat, Nat.reduceEqDiff, or_self, not_false_eq_true, Finset.sum_singleton,\n    Nat.reduceSub, Nat.nth_prime_one_eq_three, Nat.nth_prime_two_eq_five,\n    Nat.nth_prime_four_eq_eleven, Nat.nth_prime_six_eq_seventeen,\n    Nat.nth_prime_seven_eq_nineteen]\n  decide\n\n/--\nConjecture (i): $a(n) > 0$ unless $n$ divides $6$.\n-/\n@[category research open, AMS 11]\ntheorem conjecture_1 (n : ℕ) (hn : 0 < n) :\n    0 < a n ↔ ¬(n ∣ 6) := by\n  sorry\n\n/--\nConjecture (i): $a(n) = 1$ only for\n$n \\in \\{4, 5, 7, 10, 11, 12, 19, 21, 22, 31, 42, 44\\}$.\n-/\n@[category research open, AMS 11]\ntheorem conjecture_2 (n : ℕ) (hn : 0 < n) :\n    a n = 1 ↔ n ∈ ({4, 5, 7, 10, 11, 12, 19, 21, 22, 31, 42, 44} : Set ℕ) := by\n  sorry\n\n/--\nConjecture (ii): If $n > 2$ is not equal to $9$, then\n$\\text{prime}(n)^2 + (\\text{prime}(p) - 1)^2$ is prime for some prime $p < n$.\n-/\n@[category research open, AMS 11]\ntheorem conjecture_3 (n : ℕ) (hn : 2 < n) (hn9 : n ≠ 9) :\n    ∃ p : ℕ, p < n ∧ p.Prime ∧\n      Nat.Prime (Nat.nth Nat.Prime (n - 1) ^ 2 + (Nat.nth Nat.Prime (p - 1) - 1) ^ 2) := by\n  sorry\n\n/--\nConjecture (iii), part 1: For $n > 3$, there is a prime $p < n$ with\n$\\text{prime}(p) + \\text{prime}(n) + 1$ prime.\n-/\n@[category research open, AMS 11]\ntheorem conjecture_4 (n : ℕ) (hn : 3 < n) :\n    ∃ p : ℕ, p < n ∧ p.Prime ∧\n      Nat.Prime (Nat.nth Nat.Prime (p - 1) + Nat.nth Nat.Prime (n - 1) + 1) := by\n  sorry\n\n/--\nConjecture (iii), part 2: If $n > 9$ is not equal to $18$, then\n$\\text{prime}(p)^2 + \\text{prime}(n)^2 - 1$ is prime for some prime $p < n$.\n-/\n@[category research open, AMS 11]\ntheorem conjecture_5 (n : ℕ) (hn : 9 < n) (hn18 : n ≠ 18) :\n    ∃ p : ℕ, p < n ∧ p.Prime ∧\n      Nat.Prime (Nat.nth Nat.Prime (p - 1) ^ 2 + Nat.nth Nat.Prime (n - 1) ^ 2 - 1) := by\n  sorry\n\nend OeisA238585\n",
  "statement_hash": "a3163c90b95afcb44b4b580dcfa3cea26ea1557b71747b74594734f587f2a4fb",
  "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."
}