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

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Shanks's asymptotic conjecture for maximal prime gaps

Source:Wikipedia lists of open problems
Open problem Nobody knows the answer yet — neither on paper nor in Lean. First verified proof: +100 points.
Statement:reviewed
Statement:

Shanks's maximal prime gap conjecture (1964): the maximal prime gap G(x)G(x) starting below xx satisfies G(x)∼(log⁡x)2G(x) \sim (\log x)^2 as x→∞x \to \infty (contradicted by Granville's refinement predicting lim sup⁡n→∞gn/(log⁡pn)2≥2e−γ\limsup_{n \to \infty} g_n / (\log p_n)^2 \ge 2e^{-\gamma}).

Subjects:Number Theory (math.NT)
MSC classes:11
Cite as:NS.08180 [math.NT] · NS.08180v1 for this version
Declaration:MaximalPrimeGap.shanks_maximal_prime_gap_conjecture
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 100, later ones: 10; accepted critique: up to 60
Statement hash:7f56d450d6e3fa0c6df89d4fb8da9815d40a553f511af98e4cf6e1c4bdf0c22f
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/Wikipedia/MaximalPrimeGap.lean

Formal statement

theorem shanks_maximal_prime_gap_conjecture :
    (fun x : ℝ => (sup_primeGap x : ℝ)) ~[Filter.atTop]
      (fun x : ℝ => (Real.log x) ^ 2)
Show the full Challenge.lean (112 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Shanks's asymptotic conjecture for maximal prime gaps

Writing $p_n$ for the $n$-th prime ($0$-indexed, $p_0 = 2$) and $g_n = p_{n+1} - p_n$ (`primeGap n`)
for the $n$-th prime gap, let $G(x) = \max_{p_n < x} g_n$ (`sup_primeGap x`) denote the largest
prime gap starting below $x$ (which has the same asymptotic growth as $\max_{p_n \le x} g_n$). An
index $n$ marks a record (maximal) gap whenever $g_m < g_n$ for all $m < n$. Strengthening
Cramér's prime-gap heuristic, Daniel Shanks (1964) conjectured that $G(x) \sim (\log x)^2$ as
$x \to \infty$. By contrast, Andrew Granville's (1995) sieve-adjusted model predicts
$\limsup_{n \to \infty} g_n / (\log p_n)^2 \ge 2e^{-\gamma} \approx 1.1229$, contradicting
Shanks's conjecture. See also `Erdos5`.

*References:*
- [Wikipedia](https://en.wikipedia.org/wiki/Cram%C3%A9r%27s_conjecture#Shanks_conjecture)
- [Wikipedia: Prime gap](https://en.wikipedia.org/wiki/Prime_gap#Numerical_results)
- D. Shanks, *On maximal gaps between successive primes*, Math. Comp. **18** (1964), no. 88,
  646–651.
- A. Granville, *Harald Cramér and the distribution of prime numbers*, Scand. Actuar. J. **1995**
  (1995), no. 1, 12–28.
-/

@[expose] public section

open scoped Asymptotics

namespace MaximalPrimeGap

/-- Predicate that index $n$ achieves a strictly larger `primeGap` than all earlier indices
$m < n$. -/
def IsMaximalPrimeGapIndex (n : ℕ) : Prop :=
  ∀ m : ℕ, m < n → primeGap m < primeGap n

/-- Checks the first three indices and `sup_primeGap` at $x = 6$: $g_0 = 1$ and $g_1 = 2$ are
record gaps, $g_2 = 2$ is not, and $G(6) = \max(1, 2, 2) = 2$. -/
@[category test, AMS 11]
theorem maximal_prime_gap_initial_indices :
    IsMaximalPrimeGapIndex 0 ∧ IsMaximalPrimeGapIndex 1 ∧ ¬ IsMaximalPrimeGapIndex 2 ∧
      sup_primeGap 6 = 2 := by
  have hp0 : Nat.nth Nat.Prime 0 = 2 := Nat.nth_prime_zero_eq_two
  have hp1 : Nat.nth Nat.Prime 1 = 3 := Nat.nth_prime_one_eq_three
  have hp2 : Nat.nth Nat.Prime 2 = 5 := Nat.nth_prime_two_eq_five
  have hp3 : Nat.nth Nat.Prime 3 = 7 := Nat.nth_prime_three_eq_seven
  have hg0 : primeGap 0 = 1 := by simp [primeGap, hp0, hp1]
  have hg1 : primeGap 1 = 2 := by simp [primeGap, hp1, hp2]
  have hg2 : primeGap 2 = 2 := by simp [primeGap, hp2, hp3]
  refine ⟨fun _ hm => by omega, ?_, ?_, ?_⟩
  · intro m hm
    have hm0 : m = 0 := by omega
    subst hm0
    omega
  · intro h2
    have hlt := h2 1 (by omega)
    omega
  · unfold sup_primeGap
    have hc : ⌈(6 : ℝ)⌉₊ = 6 := by norm_num
    have hpc : Nat.primeCounting' 6 = 3 := by decide
    rw [hc, hpc]
    simp [Finset.range_add_one, hg0, hg1, hg2]

/-- Index $0$ ($g_0 = 3 - 2 = 1$) is vacuously a record prime gap index. -/
@[category API, AMS 11]
theorem isMaximalPrimeGapIndex_zero : IsMaximalPrimeGapIndex 0 :=
  maximal_prime_gap_initial_indices.1

/-- Infinitely many indices $n$ achieve a new record prime gap, since prime gaps are unbounded. -/
@[category textbook, AMS 11]
theorem infinite_maximalPrimeGapIndex :
    {n : ℕ | IsMaximalPrimeGapIndex n}.Infinite := by
  sorry

/-- Shanks's maximal prime gap conjecture (1964): the maximal prime gap $G(x)$ starting below $x$
satisfies $G(x) \sim (\log x)^2$ as $x \to \infty$ (contradicted by Granville's refinement
predicting $\limsup_{n \to \infty} g_n / (\log p_n)^2 \ge 2e^{-\gamma}$). -/
@[category research open, AMS 11]
theorem shanks_maximal_prime_gap_conjecture :
    (fun x : ℝ => (sup_primeGap x : ℝ)) ~[Filter.atTop]
      (fun x : ℝ => (Real.log x) ^ 2) := by
  sorry

/-- Record-index consequence of Shanks's conjecture (derived as a corollary of
`shanks_maximal_prime_gap_conjecture` rather than stated directly on Wikipedia): as $n$ runs
through indices with `IsMaximalPrimeGapIndex n`, the ratio $g_n / (\log p_n)^2$ converges to
$1$. -/
@[category research open, AMS 11]
theorem shanks_maximal_prime_gap_conjecture.variants.record_indices :
    Filter.Tendsto
      (fun k : {n : ℕ // IsMaximalPrimeGapIndex n} =>
        (primeGap k.1 : ℝ) / (Real.log (Nat.nth Nat.Prime k.1 : ℝ)) ^ 2)
      Filter.atTop (nhds 1) := by
  sorry

end MaximalPrimeGap

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

nosorry fetch wikipedia-maximalprimegap
nosorry submit wikipedia-maximalprimegap nosorry/wikipedia-maximalprimegap/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.