Title:Euclid–Fortunate prime coverage
Statement:OEIS A067836 asks: "Do all primes occur in the sequence?"
| Subjects: | Number Theory (math.NT) |
| MSC classes: | 11 |
| Tags: | question |
| Cite as: | NS.06736 [math.NT] · NS.06736v1 for this version |
| Declaration: | OeisA67836.conjecture |
| Verification: | Lean kernel (formal proof) |
| Points: | first verified proof or disproof: 100, later ones: 10; accepted critique: up to 60 |
| Statement hash: | 32c1edee13260941b255705ca852c89b8b0fab360f67e5a3a34a4051d64477c1 |
| Toolchain: | leanprover/lean4:v4.33.1 |
| Licence: | Apache-2.0 · google-deepmind/formal-conjectures contributors |
| Upstream: | FormalConjectures/OEIS/67836.lean |
Formal statement
theorem conjecture :
∀ p, p.Prime → ∃ n ≥ 1, a n = pShow the full Challenge.lean (143 lines) — definitions included
module
public import FormalConjecturesUtil
/-!
# Euclid–Fortunate prime coverage
OEIS A067836 starts with $2$. Each later term is the gap from the product of all previous terms to
the least prime strictly greater than that product plus one.
*References:*
- [OEIS A067836](https://oeis.org/A067836)
-/
@[expose] public section
namespace OeisA67836
/-- The finite set in which the least prime strictly above `n` is sought. -/
def primeCandidates (n : ℕ) : Finset ℕ :=
(Finset.Icc (n + 1) (2 * (n + 1))).filter Nat.Prime
/-- Bertrand's postulate makes the finite prime-candidate set nonempty. -/
@[category API, AMS 11]
lemma primeCandidates_nonempty (n : ℕ) : (primeCandidates n).Nonempty := by
obtain ⟨p, hp, hnp, hp_le⟩ := Nat.bertrand (n + 1) (by omega)
refine ⟨p, ?_⟩
simp only [primeCandidates, Finset.mem_filter, Finset.mem_Icc]
exact ⟨⟨by omega, hp_le⟩, hp⟩
/-- The least prime strictly greater than `n`, found in the Bertrand interval. -/
def leastPrimeAbove (n : ℕ) : ℕ :=
(primeCandidates n).min' (primeCandidates_nonempty n)
/-- The chosen number is strictly above the bound and is prime. -/
@[category API, AMS 11]
lemma leastPrimeAbove_spec (n : ℕ) :
n < leastPrimeAbove n ∧ (leastPrimeAbove n).Prime := by
have hmem := Finset.min'_mem (primeCandidates n) (primeCandidates_nonempty n)
simp only [primeCandidates, Finset.mem_filter, Finset.mem_Icc] at hmem
have hbound : n < leastPrimeAbove n := by
simpa only [leastPrimeAbove, primeCandidates, Nat.lt_iff_add_one_le] using hmem.1.1
have hprime : (leastPrimeAbove n).Prime := by
simpa only [leastPrimeAbove, primeCandidates] using hmem.2
exact ⟨hbound, hprime⟩
/-- The least prime above `n` is no larger than any other prime above `n`. -/
@[category API, AMS 11]
lemma leastPrimeAbove_le (n p : ℕ) (hnp : n < p) (hp : p.Prime) :
leastPrimeAbove n ≤ p := by
by_cases hp_bound : p ≤ 2 * (n + 1)
· have hp_mem : p ∈ primeCandidates n := by
simp only [primeCandidates, Finset.mem_filter, Finset.mem_Icc]
exact ⟨⟨by omega, hp_bound⟩, hp⟩
exact Finset.min'_le _ _ hp_mem
· have hmem := Finset.min'_mem (primeCandidates n) (primeCandidates_nonempty n)
simp only [primeCandidates, Finset.mem_filter, Finset.mem_Icc] at hmem
have hbound : leastPrimeAbove n ≤ 2 * (n + 1) := by
simpa only [leastPrimeAbove, primeCandidates] using hmem.1.2
omega
/-- No number strictly between `n` and `leastPrimeAbove n` is prime. -/
@[category API, AMS 11]
lemma not_prime_of_lt_leastPrimeAbove (n p : ℕ) (hnp : n < p)
(hp : p < leastPrimeAbove n) : ¬ p.Prime := by
intro hp_prime
have := leastPrimeAbove_le n p hnp hp_prime
omega
/-- A convenient criterion for computing the least prime above a concrete bound. -/
@[category API, AMS 11]
lemma leastPrimeAbove_eq (n p : ℕ) (hnp : n < p) (hp : p.Prime)
(hmin : ∀ q, n < q → q < p → ¬ q.Prime) : leastPrimeAbove n = p := by
apply Nat.le_antisymm (leastPrimeAbove_le n p hnp hp)
by_contra h
have hlt : leastPrimeAbove n < p := by omega
exact hmin (leastPrimeAbove n) (leastPrimeAbove_spec n).1 hlt (leastPrimeAbove_spec n).2
/-- The recursive state records the latest term and the product of all official terms so far. -/
structure State where
term : ℕ
product : ℕ
/-- The state after `n` official terms, with the empty state initialized by term and product one. -/
def state : ℕ → State
| 0 => ⟨1, 1⟩
| n + 1 =>
let previous := state n
let next := leastPrimeAbove (previous.product + 1) - previous.product
⟨next, previous.product * next⟩
/-- OEIS A067836, with the convenience value `a 0 = 1` preceding its official first term. -/
def a (n : ℕ) : ℕ :=
(state n).term
@[category test, AMS 11]
theorem a_0 : a 0 = 1 := by rfl
@[category test, AMS 11]
theorem a_1 : a 1 = 2 := by
decide
@[category test, AMS 11]
theorem a_2 : a 2 = 3 := by
decide
@[category test, AMS 11]
theorem a_3 : a 3 = 5 := by
decide
@[category test, AMS 11]
theorem a_4 : a 4 = 7 := by
decide
set_option maxRecDepth 10000 in
@[category test, AMS 11]
theorem a_5 : a 5 = 13 := by
decide
/-- [OEIS A067836](https://oeis.org/A067836) asks: "Do all primes occur in the sequence?" -/
@[category research open, question, AMS 11]
theorem conjecture :
∀ p, p.Prime → ∃ n ≥ 1, a n = p := by
sorry
end OeisA67836
To prove it: keep every definition of Challenge.lean unchanged and prove OeisA67836.conjecture with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_conjecture : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.
nosorry fetch oeis-67836 nosorry submit oeis-67836 nosorry/oeis-67836/Solution.lean --wait
Contributions
No contributions yet — be the first. Submit a proof or a finding.
Research in progress
People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.
Nobody has shared research on this problem yet.
Sign in to share your research.
Statement review
Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.
Sign in to open a critique.