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 235

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 Nk=2⋅3⋯pkN_k=2\cdot 3\cdots p_k and {a1<a2<⋯<aϕ(Nk)}\{a_1<a_2<\cdots <a_{\phi(N_k)}\} be the integers <Nk<N_k which are relatively prime to NkN_k. Then, for any c≥0c\geq 0, the limit #{ai−ai−1≤cNkϕ(Nk):2≤i≤ϕ(Nk)}ϕ(Nk)\frac{\#\{ a_i-a_{i-1}\leq c \frac{N_k}{\phi(N_k)} : 2\leq i\leq \phi(N_k)\}}{\phi(N_k)} exists and is a continuous function of cc.

Solved by Hooley [Ho65], who proved that these gaps have an exponential distribution: that is, if f(c)f(c) is the function in question, then f(c)=(1+o(1))(1−e−c)f(c)=(1+o(1))(1-e^{-c}) (where the o(1)o(1) goes to 00 uniformly as k→∞k\to \infty).

See also 234 for a more difficult version of this problem using actual primes.

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

Formal statement

theorem erdos_235 :
    ∃ f : ℝ → ℝ, ContinuousOn f (Set.Ici (0 : ℝ)) ∧
      ∀ c, 0 ≤ c → Tendsto (fun k ↦ proportion k c) atTop (𝓝 (f c))
Show the full Challenge.lean (116 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Erdős Problem 235

*References:*
- [erdosproblems.com/235](https://www.erdosproblems.com/235)
- [Ho65] Hooley, Christopher, _On the difference between consecutive numbers prime to $n$_. II.
  Publ. Math. Debrecen (1965), 39--49.
-/

@[expose] public section

open Filter
open scoped Topology

namespace Erdos235

/-- The product of the first `k + 1` primes.
On [erdosproblems.com/235](https://www.erdosproblems.com/235) this is $N_{k+1}=2\cdot 3\cdots p_{k+1}$.
The limit as $k\to\infty$ is the same for either indexing. -/
noncomputable def N (k : ℕ) : ℕ :=
  primorial (Nat.nth Nat.Prime k)

/-- The increasing list of integers `< n` that are coprime to `n`. -/
def coprimeList (n : ℕ) : List ℕ :=
  ({a ∈ Finset.range n | n.Coprime a}).sort (· ≤ ·)

/-- The gaps $a_i - a_{i-1}$ between consecutive entries of `coprimeList n`. -/
def gaps (n : ℕ) : List ℕ :=
  (coprimeList n).zipWith (fun a b ↦ b - a) (coprimeList n).tail

/-- The number of gaps of size at most $c \cdot n / \varphi(n)$. -/
noncomputable def countGaps (n : ℕ) (c : ℝ) : ℕ :=
  (gaps n).countP fun g ↦ decide ((g : ℝ) ≤ c * (n : ℝ) / (n.totient : ℝ))

/-- The proportion appearing in `erdos_235`, for the primorial `N k`. -/
noncomputable def proportion (k : ℕ) (c : ℝ) : ℝ :=
  (countGaps (N k) c : ℝ) / ((N k).totient : ℝ)

/-- `N 0` is the primorial of $2$. -/
@[category test, AMS 11]
theorem N_zero : N 0 = 2 := by
  simp [N, Nat.nth_prime_zero_eq_two, primorial_two]

/-- `N 1` is the primorial of $3$. -/
@[category test, AMS 11]
theorem N_one : N 1 = 6 := by
  simp [N, Nat.nth_prime_one_eq_three]
  decide

/-- `coprimeList n` has length $\varphi(n)$. -/
@[category test, AMS 11]
theorem coprimeList_length (n : ℕ) : (coprimeList n).length = n.totient := by
  rw [coprimeList, Finset.length_sort (· ≤ ·), Nat.totient_eq_card_coprime]

/-- $\varphi(N_k)$ is positive, so the proportion is not a division by zero. -/
@[category test, AMS 11]
theorem totient_N_pos (k : ℕ) : 0 < (N k).totient := by
  rw [Nat.totient_pos]
  exact primorial_pos (Nat.nth Nat.Prime k)

set_option linter.style.formal_proof_palomar false in
/--
Let $N_k=2\cdot 3\cdots p_k$ and $\{a_1<a_2<\cdots <a_{\phi(N_k)}\}$ be the integers $<N_k$ which
are relatively prime to $N_k$. Then, for any $c\geq 0$, the limit
$$\frac{\#\{ a_i-a_{i-1}\leq c \frac{N_k}{\phi(N_k)} : 2\leq i\leq \phi(N_k)\}}{\phi(N_k)}$$
exists and is a continuous function of $c$.

Solved by Hooley [Ho65], who proved that these gaps have an exponential distribution: that is, if
$f(c)$ is the function in question, then
$$f(c)=(1+o(1))(1-e^{-c})$$
(where the $o(1)$ goes to $0$ uniformly as $k\to \infty$).

See also [234](https://www.erdosproblems.com/234) for a more difficult version of this problem using
actual primes.
-/
@[category research solved, AMS 11,
  formal_proof using lean4 at "https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos235.lean#L4266"]
theorem erdos_235 :
    ∃ f : ℝ → ℝ, ContinuousOn f (Set.Ici (0 : ℝ)) ∧
      ∀ c, 0 ≤ c → Tendsto (fun k ↦ proportion k c) atTop (𝓝 (f c)) := by
  sorry

set_option linter.style.formal_proof_palomar false in
/--
Hooley [Ho65] proved that the limit in `erdos_235` is $1-e^{-c}$.
For each fixed $c\geq 0$,
$$f(c)=(1+o(1))(1-e^{-c})$$
as $k\to\infty$.
-/
@[category research solved, AMS 11,
  formal_proof using lean4 at "https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos235.lean#L4266"]
theorem erdos_235.variants.hooley (c : ℝ) (hc : 0 ≤ c) :
    Tendsto (fun k ↦ proportion k c) atTop (𝓝 (1 - Real.exp (-c))) := by
  sorry

end Erdos235

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

nosorry fetch erdos-235
nosorry submit erdos-235 nosorry/erdos-235/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.