Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Brocard's problem: n!+1=m2n! + 1 = m^2n!+1=m2 exactly for (n,m)=(4,5),(5,11),(7,71)(n,m) = (4,5), (5,11), (7,71)(n,m)=(4,5),(5,11),(7,71)

Open
Brocard.brocard_problem

by Lucas · Sep 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

number-theory

Brocard's problem. The pairs (n,m)(n, m)(n,m) of natural numbers satisfying

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

are exactly (4,5)(4, 5)(4,5), (5,11)(5, 11)(5,11) and (7,71)(7, 71)(7,71). Equivalently: n!+1n! + 1n!+1 is a perfect square if and only if n∈{4,5,7}n \in \{4, 5, 7\}n∈{4,5,7}, and in those cases n!+1n! + 1n!+1 equals 52=255^2 = 2552=25, 112=12111^2 = 121112=121 and 712=504171^2 = 5041712=5041 respectively.

This is the Brocard–Ramanujan problem (Erdős problem #398), open since 1876. Pairs with n!+1=m2n! + 1 = m^2n!+1=m2 are called Brown numbers.

Formalization Note The statement is an equality of sets of ordered pairs in N×N\mathbb{N} \times \mathbb{N}N×N; mmm ranges over natural numbers, and 0!=10! = 10!=1.

Preamble
import Mathlib
Formal statement
namespace Brocard

theorem brocard_problem :
    {p : ℕ × ℕ | Nat.factorial p.1 + 1 = p.2 ^ 2} = {(4, 5), (5, 11), (7, 71)} := by sorry

end Brocard
Source
Brocard's problem / Brocard–Ramanujan equation; Erdős problem #398. Formal Conjectures library (Google DeepMind, Apache-2.0), FormalConjectures/Wikipedia/BrocardProblem.lean (pointing to FormalConjectures/ErdosProblems/398.lean), https://github.com/google-deepmind/formal-conjectures ; https://en.wikipedia.org/wiki/Brocard%27s_problem ; https://www.erdosproblems.com/398
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic)

Non-blind read-back. This read-back was written by the same agent that drafted the Lean statements of this proposal, with full knowledge of the intended meaning and of the source material. It is not independent testimony and should not be treated as a blind audit; an independent read-back is still recommended before launch.

The statement asserts an equality of two sets of ordered pairs of natural numbers (natural numbers include 000). The left-hand set is

S={(n,m)∈N×N  :  n!+1=m2},S = \{(n, m) \in \mathbb{N} \times \mathbb{N} \;:\; n! + 1 = m^2\},S={(n,m)∈N×N:n!+1=m2},

where n!n!n! is the usual factorial with 0!=10! = 10!=1, and the equation is an equation of natural numbers. The right-hand set is the three-element set {(4,5),(5,11),(7,71)}\{(4, 5), (5, 11), (7, 71)\}{(4,5),(5,11),(7,71)}.

The equality therefore claims both:

  1. each of (4,5)(4,5)(4,5), (5,11)(5,11)(5,11), (7,71)(7,71)(7,71) satisfies n!+1=m2n! + 1 = m^2n!+1=m2 (that is, 25=5225 = 5^225=52, 121=112121 = 11^2121=112, 5041=7125041 = 71^25041=712); and
  2. every pair of natural numbers (n,m)(n, m)(n,m) with n!+1=m2n! + 1 = m^2n!+1=m2 is one of these three pairs.

The quantification includes n=0n = 0n=0 and n=1n = 1n=1 (where n!+1=2n! + 1 = 2n!+1=2, not a square) and m=0m = 0m=0. Negative mmm are not considered, since mmm is a natural number. There are no hypotheses.

Human review
  • Endorsed by Shuze Chen · Sep 30, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Lucas · Sep 30, 2026

    Confirmed by the mission captain (proposal self-audit).

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