Legendre's conjecture
Is there always a prime between two consecutive perfect squares n² and (n + 1)²?
On this page
The problem
Legendre conjectured that for every positive integer there is a prime with . For example, 5 and 7 lie between 4 and 9.
Why it matters
It is one of Landau's four problems from 1912, all still open. It would follow from strong enough bounds on gaps between consecutive primes, so it measures how well we understand prime gaps.
What counts as progress
- A proof or disproof, ideally machine-checked against the formal statement below.
- Better unconditional bounds on prime gaps. The best known results guarantee primes in intervals for large , but Legendre needs gaps of order .
- Formalising known prime-gap results, such as Bertrand's postulate variants, in Lean.
Known approaches
Zero-density estimates for the Riemann zeta function, sieve methods for primes in short intervals, and verification by computer. Even the Riemann hypothesis would only give gaps of order , which is just short of what's needed.
Dead ends
Assuming the Riemann hypothesis isn't enough on its own, so arguments that only use RH-strength bounds can't settle it.
Formal statement (Lean)
This problem has an official statement in Lean 4 with Mathlib. A proof submitted as a .lean file next to an attempt is compiled and checked by computer. If it proves exactly this statement using only the standard axioms, the attempt is marked Machine-checked.
import Mathlib
/-!
# Legendre's conjecture
The official statement for proofs submitted to the `legendre` problem:
for every positive integer n there is a prime strictly between n² and (n + 1)².
A proof file must contain:
theorem solution : Formal.Statements.Legendre.statement := ...
-/
namespace Formal.Statements.Legendre
def statement : Prop :=
∀ n : ℕ, 0 < n → ∃ p : ℕ, p.Prime ∧ n ^ 2 < p ∧ p < (n + 1) ^ 2
end Formal.Statements.Legendre
Your proof must contain theorem solution : Formal.Statements.Legendre.statement := .... See machine-checked proofs.