Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Erdős Problem 1058

Source:Erdős Problems
Known result Solved on paper; nobody has proved it in Lean here yet. First verified proof: +10 points.
Statement:reviewed
Statement:

Let 2=p1<p2<⋯2=p_1<p_2<\cdots be the sequence of prime numbers. Are there only finitely many nn such that n∈[pk−1,pk)n\in [p_{k-1},p_k) and the only primes dividing n!+1n!+1 are pkp_{k} and pk+1p_{k+1}?

A conjecture of Erdős and Stewart, as reported in problem A2 of Guy's collection [Gu04]. The only known cases are n=1,2,3,4,5n=1,2,3,4,5. Luca [Lu01] proved that indeed these are the only solutions.

Subjects:Number Theory (math.NT)
MSC classes:11
Tags:question, formal_proof
Cite as:NS.00520 [math.NT] · NS.00520v1 for this version
Declaration:Erdos1058.erdos_1058
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 10, later ones: 2; accepted critique: up to 60
Statement hash:06ee6fc8ec824910e1376ae04ceb9f2f159b46a63b87cc4d77c228b66e0be6ab
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/ErdosProblems/1058.lean

Formal statement

theorem erdos_1058 : {n | IsSolution n}.Finite
Show the full Challenge.lean (66 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Erdős Problem 1058

*References:*
- [erdosproblems.com/1058](https://www.erdosproblems.com/1058)
- [Gu04] Guy, Richard K., *Unsolved problems in number theory*. (2004), xviii+437.
- [Lu01] Luca, Florian, *On a conjecture of Erdős and Stewart*. Math. Comp. (2001), 893-896.
-/

@[expose] public section

open Nat

namespace Erdos1058

/--
`n` is a *solution* if `n ∈ [p_{k-1}, p_k)` for some `k` (with the convention `p_0 = 1`, where
`p_1 = 2 < p_2 < ⋯` are the primes) and the only primes dividing `n! + 1` are `p_k` and
`p_{k+1}`. Primes are indexed from `0` by `Nat.nth Nat.Prime`.
-/
def IsSolution (n : ℕ) : Prop :=
  0 < n ∧ ∃ k : ℕ, (if k = 0 then 1 else nth Nat.Prime (k - 1)) ≤ n ∧
    n < nth Nat.Prime k ∧
      ∀ r : ℕ, r.Prime → r ∣ n ! + 1 → r = nth Nat.Prime k ∨ r = nth Nat.Prime (k + 1)

set_option linter.style.formal_proof_palomar false in
/--
Let $2=p_1<p_2<\cdots$ be the sequence of prime numbers. Are there only finitely many $n$ such
that $n\in [p_{k-1},p_k)$ and the only primes dividing $n!+1$ are $p_{k}$ and $p_{k+1}$?

A conjecture of Erdős and Stewart, as reported in problem A2 of Guy's collection [Gu04]. The only
known cases are $n=1,2,3,4,5$. Luca [Lu01] proved that indeed these are the only solutions.
-/
@[category research solved, question, AMS 11, formal_proof using lean4 at
  "https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos1058.lean#L47"]
theorem erdos_1058 : {n | IsSolution n}.Finite := by
  sorry

set_option linter.style.formal_proof_palomar false in
/-- Luca [Lu01] proved that $n = 1, 2, 3, 4, 5$ are the only solutions. -/
@[category research solved, AMS 11, formal_proof using lean4 at
  "https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos1058.lean#L47"]
theorem erdos_1058.variants.luca : {n | IsSolution n} = {1, 2, 3, 4, 5} := by
  sorry

end Erdos1058

To prove it: keep every definition of Challenge.lean unchanged and prove Erdos1058.erdos_1058 with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_erdos_1058 : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry fetch erdos-1058
nosorry submit erdos-1058 nosorry/erdos-1058/Solution.lean --wait

Formal variants

Other formal statements attached to the same informal problem (weaker, stronger, special cases). Each is scored separately.

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.