Legendre's conjecture: a prime between every two consecutive squares
On this page17 sections
Difficulty 84: one of Landau's four problems, and harder than it looks because even the Riemann Hypothesis (96) gives gaps of only √p·log p, a log factor short; the best unconditional exponent is 0.525 against the 0.5 needed. It sits just below the twin prime conjecture (87 in the calibration pass) and abc (85), and above the conditional parity-barrier gap problem (80), which at least has a precise sieve target. The unrefereed Ferreira claim does not move the grade. Application value 3.5: none beyond methods for primes in short intervals. Leverage 24: Andrica- and Brocard-type statements follow, little else.
The problem
Is there always a prime number between two consecutive perfect squares?
- 1Squares spread out; primes thin out
- 2Gaps must stay below about sqrt(p)
- 3Best proof only reaches p^0.525
- 4Even RH falls a logarithm short
The question. Between and lie the primes and ; between and lie and ; between and lie and . Legendre asked whether there is always at least one prime between consecutive squares and . In Lean: ∀ n ≥ 1, ∃ p ∈ Set.Ioo (n ^ 2) ((n + 1) ^ 2), Nat.Prime p, where Set.Ioo a b is the open interval .
A question about gaps. The interval has length , about for numbers near . So the conjecture says, roughly, that the prime gap after a prime (the distance to the next prime) never exceeds about .
How big are prime gaps? The prime number theorem says primes near are spaced apart on average, which is tiny compared with : near , while . The largest gaps found by computer are only about . So the conjecture looks safe numerically, and it has been checked for all up to .
Why it is not proved. A bound on every gap is much harder than a statement about the average. The best unconditional result (Baker, Harman and Pintz, 2001) finds a prime in every interval for large , so gaps are below ; Legendre needs the exponent . Even the Riemann Hypothesis, the most famous open problem about primes, only gives gaps below a constant times , too weak by a factor of . The methods work through the zeros of the Riemann zeta function: few zeros away from the critical line means primes are evenly spread over short intervals, and current estimates stop at the exponent .
A claim to watch. A 2023 preprint by Ferreira (revised May 2026, not peer reviewed) claims that every interval with fixed contains the expected number of primes for large . That would give Legendre for all large , and it goes beyond what even the Riemann Hypothesis gives, so it needs very careful checking.
How a solution is checked. A Lean proof of the declaration above, compared with the corpus statement by a checking tool. A proof for large only is partial progress; the remaining small could then be closed by a certified computation.
Go deeper
The full technical text.
For every integer there is a prime with .
Lean 4 statement in the Formal Conjectures corpus:
theorem legendre_conjecture :
∀ n ≥ 1, ∃ p ∈ Set.Ioo (n ^ 2) ((n + 1) ^ 2), Nat.Prime p
Words on this page (7)
- perfect square
- A number that is a whole number times itself, like 25.
- prime gap
- The distance between one prime and the next.
- Riemann Hypothesis
- A famous unproved statement about where the zeros of the zeta function lie.
- zero-density estimate
- A bound on how many zeta zeros can lie away from the critical line.
- Cramér's conjecture
- A guess that prime gaps are never much larger than the square of the logarithm.
- exponential sum
- A sum of numbers on the unit circle used to detect patterns in primes.
- unrefereed preprint
- A paper posted publicly that has not passed peer review.
New to this? Read first (2)
- Legendre's conjecture (Wikipedia)The known partial results in one place.
- Prime gap (Wikipedia)Background on how far apart primes are and the best known bounds.
Path to understanding
foundations → problemThe research entries this problem rests on, in the order to read them. Each links to its explainer.
- Start with
- Step 2
- Harmonic analysisTheory
- Step 3
- Then
- Legendre's conjecture: a prime between every two consecutive squaresThe problem
State of the art
Known gap bounds are too weak. Baker, Harman and Pintz (2001) proved a prime exists in for all large , so gaps of size ; Legendre needs gaps below about , i.e. exponent . Under the Riemann Hypothesis Cramér showed gaps are , still a logarithm short. Cramér's heuristic gap size would give Legendre for large . Numerics: a table of maximal prime gaps confirms the conjecture up to . Unrefereed claim: a 2023 arXiv preprint by Luan Alberto Ferreira (revised May 2026, submitted to Annals of Mathematics, not published) claims that every interval with contains asymptotically primes, which would give Legendre for all sufficiently large (the Formal Conjectures file labels the large- statement as solved, citing Ferreira). It has not been confirmed by independent review; since the Riemann Hypothesis gives such asymptotics only for , the claim goes beyond RH and needs especially careful checking. Even if correct, it would not settle small beyond the numerical range.
Realistic applications
None directly; primes in short intervals matter for the analysis of algorithms that search for primes, but nothing deployed depends on the exponent. The methods (zero-density estimates and exponential sums) are reused elsewhere in analytic number theory.
What counts as solved
A Lean proof of legendre_conjecture as stated. A proof of the eventual version alone (for all sufficiently large ) is a genuine partial result and would be recorded as PARTIAL, with the finite range closed by computation checked in Lean.
How it gets verified
To verify: Lean proofA formal proof checked by Lean 4 / Mathlib.
Statement: LegendreConjecture.legendre_conjecture in formal-conjectures: ∀ n ≥ 1, ∃ p ∈ Set.Ioo (n ^ 2) ((n + 1) ^ 2), Nat.Prime p. All ingredients are in Mathlib (Nat.Prime, Set.Ioo). The same file (pinned at commit e754a78, 17 October 2026) states the eventual version legendre_conjecture.ferreira_large_n (∀ᶠ n in atTop, ..., labelled solved on the strength of Ferreira's unrefereed preprint) and a conditional implication bounded_gap_legendre with a linked Lean proof by AlphaProof, which are useful stepping stones; Mathlib itself has Bertrand's postulate (NumberTheory.Bertrand) but nothing near squares. Accept a proof only if it compiles against the corpus' pinned Mathlib and a statement-fixing judge confirms the declaration is unchanged.
Claims
Where the work is
Progress requires stronger zero-density or exponential-sum estimates; computation is limited to checking prime gaps.
Connected problems
- This problem is related to Riemann Hypothesis: all non-trivial zeros of ζ(s) lie on Re s = 1/2RH implies prime gaps of order sqrt(p) log p, which is just short of what Legendre's conjecture needs.
- This problem is related to Zero-density exponent for ζ beyond Guth–Maynard: N(σ,T) ≤ TA(σ)(1−σ)+o(1) with A < 30/13Zero-density estimates are the tool behind the short-interval prime results (Baker–Harman–Pintz, Guth–Maynard) that Legendre's conjecture would need pushed to exponent 1/2.