/-
Copyright 2025 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.
-/
import FormalConjecturesUtilLegendre's conjecture
open Filternamespace LegendreConjecture
Does there always exist at least one prime between consecutive perfect squares?
@[category research open, AMS 11]
theorem legendre_conjecture :
answer(sorry) ↔ ∀ n ≥ 1, ∃ p ∈ Set.Ioo (n ^ 2) ((n + 1) ^ 2), Nat.Prime p := ⊢ True ↔ ∀ n ≥ 1, ∃ p ∈ Set.Ioo (n ^ 2) ((n + 1) ^ 2), Nat.Prime p
All goals completed! 🐙
If there exists a constant c > 0 such that
(n + 1).nth Nat.Prime - n.nth Nat.Prime < (n.nth Nat.Prime) ^ (1 / 2 - c) for all large n,
then Legendre's conjecture is asymptotically true.
Formal proof linked here provided by AlphaProof.
@[category research solved, AMS 11, formal_proof using formal_conjectures at "https://github.com/mzhorvath1/formal-conjectures/blob/a4568d467b4f42884b6a4bd09c40d65f92113ee7/FormalConjectures/Wikipedia/LegendreConjecture.lean#L48"]
theorem bounded_gap_legendre
(H : ∃ c > 0, ∀ᶠ n in atTop, (n + 1).nth Nat.Prime - n.nth Nat.Prime <
(n.nth Nat.Prime : ℝ) ^ (1 / (2 : ℝ) - c)) :
∀ᶠ n in atTop, ∃ p ∈ Set.Ioo (n ^ 2) ((n + 1) ^ 2), Nat.Prime p := H:∃ c > 0,
∀ᶠ (n : ℕ) in atTop, ↑(Nat.nth Nat.Prime (n + 1)) - ↑(Nat.nth Nat.Prime n) < ↑(Nat.nth Nat.Prime n) ^ (1 / 2 - c)⊢ ∀ᶠ (n : ℕ) in atTop, ∃ p ∈ Set.Ioo (n ^ 2) ((n + 1) ^ 2), Nat.Prime p
All goals completed! 🐙
Ferreira proved that the conjecture is true for sufficiently large n.
@[category research solved, AMS 11]
theorem legendre_conjecture.ferreira_large_n :
∀ᶠ n in atTop, ∃ p ∈ Set.Ioo (n ^ 2) ((n + 1) ^ 2), Nat.Prime p := ⊢ ∀ᶠ (n : ℕ) in atTop, ∃ p ∈ Set.Ioo (n ^ 2) ((n + 1) ^ 2), Nat.Prime p
All goals completed! 🐙
end LegendreConjecture