{
  "id": "6736",
  "ident": "NS.06736",
  "slug": "oeis-67836",
  "title": "Euclid–Fortunate prime coverage",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "[OEIS A067836](https://oeis.org/A067836) asks: \"Do all primes occur in the sequence?\"",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA67836.conjecture",
  "statement_lean": "theorem conjecture :\n    ∀ p, p.Prime → ∃ n ≥ 1, a n = p",
  "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# Euclid–Fortunate prime coverage\n\nOEIS A067836 starts with $2$. Each later term is the gap from the product of all previous terms to\nthe least prime strictly greater than that product plus one.\n\n*References:*\n- [OEIS A067836](https://oeis.org/A067836)\n-/\n\n@[expose] public section\n\nnamespace OeisA67836\n\n/-- The finite set in which the least prime strictly above `n` is sought. -/\ndef primeCandidates (n : ℕ) : Finset ℕ :=\n  (Finset.Icc (n + 1) (2 * (n + 1))).filter Nat.Prime\n\n/-- Bertrand's postulate makes the finite prime-candidate set nonempty. -/\n@[category API, AMS 11]\nlemma primeCandidates_nonempty (n : ℕ) : (primeCandidates n).Nonempty := by\n  obtain ⟨p, hp, hnp, hp_le⟩ := Nat.bertrand (n + 1) (by omega)\n  refine ⟨p, ?_⟩\n  simp only [primeCandidates, Finset.mem_filter, Finset.mem_Icc]\n  exact ⟨⟨by omega, hp_le⟩, hp⟩\n\n/-- The least prime strictly greater than `n`, found in the Bertrand interval. -/\ndef leastPrimeAbove (n : ℕ) : ℕ :=\n  (primeCandidates n).min' (primeCandidates_nonempty n)\n\n/-- The chosen number is strictly above the bound and is prime. -/\n@[category API, AMS 11]\nlemma leastPrimeAbove_spec (n : ℕ) :\n    n < leastPrimeAbove n ∧ (leastPrimeAbove n).Prime := by\n  have hmem := Finset.min'_mem (primeCandidates n) (primeCandidates_nonempty n)\n  simp only [primeCandidates, Finset.mem_filter, Finset.mem_Icc] at hmem\n  have hbound : n < leastPrimeAbove n := by\n    simpa only [leastPrimeAbove, primeCandidates, Nat.lt_iff_add_one_le] using hmem.1.1\n  have hprime : (leastPrimeAbove n).Prime := by\n    simpa only [leastPrimeAbove, primeCandidates] using hmem.2\n  exact ⟨hbound, hprime⟩\n\n/-- The least prime above `n` is no larger than any other prime above `n`. -/\n@[category API, AMS 11]\nlemma leastPrimeAbove_le (n p : ℕ) (hnp : n < p) (hp : p.Prime) :\n    leastPrimeAbove n ≤ p := by\n  by_cases hp_bound : p ≤ 2 * (n + 1)\n  · have hp_mem : p ∈ primeCandidates n := by\n      simp only [primeCandidates, Finset.mem_filter, Finset.mem_Icc]\n      exact ⟨⟨by omega, hp_bound⟩, hp⟩\n    exact Finset.min'_le _ _ hp_mem\n  · have hmem := Finset.min'_mem (primeCandidates n) (primeCandidates_nonempty n)\n    simp only [primeCandidates, Finset.mem_filter, Finset.mem_Icc] at hmem\n    have hbound : leastPrimeAbove n ≤ 2 * (n + 1) := by\n      simpa only [leastPrimeAbove, primeCandidates] using hmem.1.2\n    omega\n\n/-- No number strictly between `n` and `leastPrimeAbove n` is prime. -/\n@[category API, AMS 11]\nlemma not_prime_of_lt_leastPrimeAbove (n p : ℕ) (hnp : n < p)\n    (hp : p < leastPrimeAbove n) : ¬ p.Prime := by\n  intro hp_prime\n  have := leastPrimeAbove_le n p hnp hp_prime\n  omega\n\n/-- A convenient criterion for computing the least prime above a concrete bound. -/\n@[category API, AMS 11]\nlemma leastPrimeAbove_eq (n p : ℕ) (hnp : n < p) (hp : p.Prime)\n    (hmin : ∀ q, n < q → q < p → ¬ q.Prime) : leastPrimeAbove n = p := by\n  apply Nat.le_antisymm (leastPrimeAbove_le n p hnp hp)\n  by_contra h\n  have hlt : leastPrimeAbove n < p := by omega\n  exact hmin (leastPrimeAbove n) (leastPrimeAbove_spec n).1 hlt (leastPrimeAbove_spec n).2\n\n/-- The recursive state records the latest term and the product of all official terms so far. -/\nstructure State where\n  term : ℕ\n  product : ℕ\n\n/-- The state after `n` official terms, with the empty state initialized by term and product one. -/\ndef state : ℕ → State\n  | 0 => ⟨1, 1⟩\n  | n + 1 =>\n      let previous := state n\n      let next := leastPrimeAbove (previous.product + 1) - previous.product\n      ⟨next, previous.product * next⟩\n\n/-- OEIS A067836, with the convenience value `a 0 = 1` preceding its official first term. -/\ndef a (n : ℕ) : ℕ :=\n  (state n).term\n\n@[category test, AMS 11]\ntheorem a_0 : a 0 = 1 := by rfl\n\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 2 := by\n  decide\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 3 := by\n  decide\n\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 5 := by\n  decide\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 7 := by\n  decide\n\nset_option maxRecDepth 10000 in\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 13 := by\n  decide\n\n/-- [OEIS A067836](https://oeis.org/A067836) asks: \"Do all primes occur in the sequence?\" -/\n@[category research open, question, AMS 11]\ntheorem conjecture :\n    ∀ p, p.Prime → ∃ n ≥ 1, a n = p := by\n  sorry\n\nend OeisA67836\n",
  "statement_hash": "32c1edee13260941b255705ca852c89b8b0fab360f67e5a3a34a4051d64477c1",
  "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."
}