{
  "id": "1190",
  "ident": "NS.01190",
  "slug": "erdos-17",
  "title": "Erdős Problem 17",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "**Erdős Problem 17.** Are there infinitely many cluster primes?",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": "https://www.erdosproblems.com/17",
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos17.erdos_17",
  "statement_lean": "theorem erdos_17 : {p : ℕ | IsClusterPrime p}.Infinite",
  "challenge_source": "/-\nCopyright 2025 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 17\n*Reference:* [erdosproblems.com/17](https://www.erdosproblems.com/17)\n-/\n\n@[expose] public section\n\nopen Filter Asymptotics Real\n\nnamespace Erdos17\n\n/-- A prime $p$ is a cluster prime if every even natural number\n$n \\le p - 3$ can be written as a difference of two primes\n$q_1 - q_2$ with $q_1, q_2 \\le p$. -/\ndef IsClusterPrime (p : ℕ) : Prop :=\n  p.Prime ∧\n    ∀ {n : ℕ}, Even n → n ≤ (p - 3 : ℤ) →\n      ∃ q₁ q₂ : ℕ, q₁.Prime ∧ q₂.Prime ∧\n        q₁ ≤ p ∧ q₂ ≤ p ∧ n = (q₁ - q₂ : ℤ)\n\n/-- **Erdős Problem 17.** Are there infinitely many cluster primes? -/\n@[category research open, question, AMS 11]\ntheorem erdos_17 : {p : ℕ | IsClusterPrime p}.Infinite := by\n  sorry\n\n/-- The counting function of cluster primes $\\le n$. -/\nnoncomputable def clusterPrimeCount (n : ℕ) : ℕ :=\n  Nat.card {p : ℕ | p ≤ n ∧ IsClusterPrime p}\n\n/--\nIn 1999 Blecksmith, Erdős, and Selfridge [BES99] proved the upper bound\n$$\\pi^{\\mathcal{C}}(x) \\ll_A x(\\log x)^{-A}$$ for every real $A > 0$.\n\n[BES99] Blecksmith, Richard and Erd\\H os, Paul and Selfridge, J. L., Cluster primes. Amer. Math. Monthly (1999), 43--48.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_17.variants.upper_BES {A : ℝ} (hA : 0 < A) :\n  (fun x ↦ (clusterPrimeCount x : ℝ)) =O[atTop] fun x ↦ x / (log x) ^ A := by\n    sorry\n\n/--\nIn 2003, Elsholtz [El03] refined the upper bound to\n$$\\pi^{\\mathcal{C}}(x) \\ll x\\,\\exp\\!\\bigl(-c(\\log\\log x)^2\\bigr)$$\nfor every real $0 < c < 1/8$.\n\n[El03] Elsholtz, Christian, On cluster primes. Acta Arith. (2003), 281--284.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_17.variants.upper_Elsholtz :\n  ∃ C : ℝ, 0 < C ∧\n    ∀ c ∈ Set.Ioo 0 (1 / 8),\n      IsBigOWith C atTop (fun x ↦ (clusterPrimeCount x : ℝ))\n        (fun x ↦ x * exp (-c * (log (log x)) ^ 2)) := by\n  sorry\n\n/-- $97$ is the smallest prime that is not a cluster prime. -/\n@[category test, AMS 11]\ntheorem isClusterPrime_97_isLeast_non_cluster : IsLeast {p : ℕ | p.Prime ∧ ¬ IsClusterPrime p} 97 := by\n  -- For a prime `p`, being a cluster prime is equivalent to a fully bounded\n  -- (hence decidable) statement over `ℕ`: every even `n ≤ p - 3` is `q₁ - q₂`\n  -- for primes `q₁, q₂ ≤ p`, which (since `n ≥ 0`) amounts to a prime `q₂ ≤ p`\n  -- with `q₂ + n` again prime and `≤ p`.\n  have cluster_iff : ∀ p : ℕ, p.Prime →\n      (IsClusterPrime p ↔\n        (∀ n ∈ Finset.range (p - 2), Even n →\n          ∃ q₂ ∈ Finset.range (p + 1), (Nat.Prime q₂) ∧ Nat.Prime (q₂ + n) ∧ q₂ + n ≤ p)) := by\n    intro p hp\n    constructor\n    · rintro ⟨-, h⟩ n hn hev\n      simp only [Finset.mem_range] at hn\n      have hn3 : (n : ℤ) ≤ (p - 3 : ℤ) := by omega\n      obtain ⟨q₁, q₂, hq1p, hq2p, hq1le, hq2le, heq⟩ := h hev hn3\n      refine ⟨q₂, ?_, hq2p, ?_, ?_⟩\n      · simp only [Finset.mem_range]; omega\n      · have hq2n : q₂ + n = q₁ := by omega\n        rw [hq2n]; exact hq1p\n      · omega\n    · intro h\n      refine ⟨hp, ?_⟩\n      intro n hev hn3\n      have hnp : n ≤ p - 3 := by omega\n      have hnrange : n ∈ Finset.range (p - 2) := by\n        simp only [Finset.mem_range]; omega\n      obtain ⟨q₂, hq2r, hq2p, hq1p, hle⟩ := h n hnrange hev\n      refine ⟨q₂ + n, q₂, hq1p, hq2p, hle, ?_, ?_⟩\n      · simp only [Finset.mem_range] at hq2r; omega\n      · push_cast; ring\n  constructor\n  · -- `97` is prime but not a cluster prime: the even number `88 ≤ 94` is not a\n    -- difference of two primes `≤ 97`.\n    refine ⟨by norm_num, ?_⟩\n    rw [cluster_iff 97 (by norm_num)]\n    simp only [Nat.reduceSub, Finset.mem_range, Nat.reduceAdd, not_forall, not_exists, not_and,\n      not_le]\n    refine ⟨88, by norm_num, by norm_num, ?_⟩\n    intro x xl hx xl\n    suffices 9 < x by\n      lia\n    contrapose! xl\n    interval_cases x <;> norm_num\n    · contrapose hx\n      exact Nat.not_prime_one\n    · contrapose hx\n      norm_num\n  · -- `97` is a lower bound: every prime `< 97` is a cluster prime, so cannot lie\n    -- in the set of non-cluster primes.\n    rintro b ⟨hbp, hbnc⟩\n    by_contra! hlt\n    interval_cases b <;>\n      first\n        | exact absurd hbp (by decide)\n        | exact hbnc ((cluster_iff _ (by norm_num)).mpr (by set_option maxRecDepth 8000 in decide))\n\nend Erdos17\n",
  "statement_hash": "5a0af67ebcaeda496b93d9267f5d824bea4b5e6eb654c4710c04025125193673",
  "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."
}