/-
Copyright 2026 The Formal Conjectures Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/modulepublicimportFormalConjecturesUtil
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.
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$.