FormalConjectures/ErdosProblems/682.lean
Explanation legend Lean4 Domain Explanation Language (L4DEL)
L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.
- L4DEL
- Lean4 Domain Explanation Language
Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.
Project sources: Pinned project documentation, Formal Conjectures paper, arXiv v1
4 declarations, 3 contain sorry, 0 declared as axioms
Erdős Problem 682
References:
- erdosproblems.com/682
- [Er79d] Erdős, P., Some unconventional problems in number theory. Acta Math. Acad. Sci. Hungar. (1979), 71-80.
- [GaTa25] A. Gafni and T. Tao, Rough numbers between consecutive primes. arXiv:2508.06463 (2025).
Imports (1)
- abbrev
Erdos682.pThenth prime, indexed from zero:p 0 = 2,p 1 = 3, line 37 sourceSource documentation
The
nth prime, indexed from zero:p 0 = 2,p 1 = 3, ...standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
NatProof uses:
Nat.nth,Nat.Primenoncomputable abbrev p (n : ℕ) : ℕ := Nat.nth Nat.Prime n …
- theorem
Erdos682.erdos_682Is it true that for almost all $n$ there exists some $m\in (p_n,p_{n+1})$ such that $$p(m) \geq p_{n+1}-p_n,$$ where $p(m)$ denotes the least prime factor of $m$? sorry line 49 sourceSource documentation
Is it true that for almost all $n$ there exists some $m\in (p_n,p_{n+1})$ such that $$p(m) \geq p_{n+1}-p_n,$$ where $p(m)$ denotes the least prime factor of $m$?
This was solved in the affirmative by Gafni and Tao [GaTa25].
This was formalized in Lean by Codex and GPT-5.6 Sol.
depends on sorry what this means
Statement uses:
Iff,True, Set.HasDensity,Nat,Set.ofPred,Exists,And,Membership.mem,Set,Set.Ioo, Erdos682.p,HAdd.hAdd,OfNat.ofNat,LE.le,HSub.hSub,Nat.minFac,Real,Set.univProof uses:
sorryAx,Lean.Name,Bool.false,Lean.Name.num,Lean.Name.str,Lean.Name.anonymous26 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
theorem erdos_682 : answer(True) ↔ {n | ∃ m ∈ Set.Ioo (p n) (p (n + 1)), p (n + 1) - p n ≤ m.minFac}.HasDensity 1 := by …Mentions: Erdos682.p
- theorem
Erdos682.erdos_682.variants.exceptional_countGafni and Tao [GaTa25, Theorem 1.1] proved that the number of exceptional gaps $(p_n,p_{n+1})$ with $p_n\in [X,2X]$ is $$\ll \frac{X}{(\log X)^2}.$$ sorry line 59 sourceSource documentation
Gafni and Tao [GaTa25, Theorem 1.1] proved that the number of exceptional gaps $(p_n,p_{n+1})$ with $p_n\in [X,2X]$ is $$\ll \frac{X}{(\log X)^2}.$$
depends on sorry what this means
Statement uses:
Asymptotics.IsBigO,Nat,Real,Filter.atTop,Set.ncard,Set.ofPred,And,Membership.mem,Set,Set.Icc,HMul.hMul,OfNat.ofNat, Erdos682.p,Set.Ioo,HAdd.hAdd,LT.lt,Nat.minFac,HSub.hSub,HDiv.hDiv,HPow.hPowand 1 moreProof uses:
sorryAx,Lean.Name,Bool.false,Lean.Name.num,Lean.Name.str,Lean.Name.anonymous40 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
theorem erdos_682.variants.exceptional_count : (fun X : ℕ ↦ ({n | p n ∈ Set.Icc X (2 * X) ∧ ∀ m ∈ Set.Ioo (p n) (p (n + 1)), m.minFac < p (n + 1) - p n}.ncard : ℝ)) =O[atTop] fun X : ℕ ↦ (X : ℝ) / Real.log X ^ 2 := by …Mentions: Erdos682.p
- theorem
Erdos682.erdos_682.variants.dickson_counterexampleErdős first thought this should be true for all large sorry line 76 sourceSource documentation
Erdős first thought this should be true for all large $n$, but found a (conditional) counterexample: Dickson's conjecture says there are infinitely many $d$ such that $$2183+30030d\textrm{ and }2201+30030d$$ are both prime, and then they must necessarily be consecutive primes. These give a counterexample since $30030=2\cdot 3 \cdot 5\cdot 7\cdot 11\cdot 13$ and every integer in $[2184,2200]$ is divisible by at least one of these primes.
This was formalized in Lean by Codex and GPT-5.6 Sol.
depends on sorry what this means
Statement uses:
Nat,Nat.Prime,HAdd.hAdd,OfNat.ofNat,HMul.hMul,Exists,And,Eq, Erdos682.p,Membership.mem,Set,Set.Ioo,LT.lt,Nat.minFac,HSub.hSubProof uses:
sorryAx,Lean.Name,Bool.false,Lean.Name.num,Lean.Name.str,Lean.Name.anonymous20 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
theorem erdos_682.variants.dickson_counterexample (d : ℕ) (h₁ : (2183 + 30030 * d).Prime) (h₂ : (2201 + 30030 * d).Prime) : ∃ n, p n = 2183 + 30030 * d ∧ p (n + 1) = 2201 + 30030 * d ∧ ∀ m ∈ Set.Ioo (p n) (p (n + 1)), m.minFac < p (n + 1) - p n := by …Mentions: Erdos682.p