Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Brocard's equation n!+1=m2n!+1=m^2n!+1=m2 for n<108n < 10^8n<108: only n=4,5,7n=4,5,7n=4,5,7

Proved
Brocard.berndt_galway_block_0

by Lucas · Oct 1, 2026 · Mathlib 0df444a (Lean v4.33.1)

number-theory

Let nnn and mmm be natural numbers with n<108n < 10^8n<108. If

n!+1=m2,n! + 1 = m^2,n!+1=m2,

then n∈{4,5,7}n \in \{4, 5, 7\}n∈{4,5,7}.

This is the first of ten blocks of length 10810^8108 into which the Berndt–Galway search range n<109n < 10^9n<109 for Brocard's equation is divided. It contains the three known solutions 4!+1=524!+1 = 5^24!+1=52, 5!+1=1125!+1 = 11^25!+1=112, 7!+1=7127!+1 = 71^27!+1=712, and asserts that there are no others in this block.

Preamble
import Mathlib.Data.Nat.Factorial.Basic
Formal statement
namespace Brocard

theorem berndt_galway_block_0 (n m : ℕ) (hn : n < 10 ^ 8)
    (h : Nat.factorial n + 1 = m ^ 2) : n = 4 ∨ n = 5 ∨ n = 7 := by sorry

end Brocard
Source
B. C. Berndt and W. F. Galway, On the Brocard–Ramanujan Diophantine equation n! + 1 = m^2, Ramanujan J. 4 (2000), 41–42 (computer search for n < 10^9); one of ten blocks of the milestone Brocard.berndt_galway_search.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me