Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Erdős Problem 405

Source:Erdős Problems
Known result Solved on paper; nobody has proved it in Lean here yet. First verified proof: +10 points.
Statement:reviewed
Statement:

Let pp be an odd prime. Is it true that the equation (p−1)!+ap−1=pk(p-1)!+a^{p-1}=p^k has only finitely many solutions?

Originally proposed by Erdős and Graham [ErGr80]. Brindza and Erdős [BrEr91] proved that there are finitely many such solutions.

Subjects:Number Theory (math.NT)
MSC classes:11
Cite as:NS.02016 [math.NT] · NS.02016v1 for this version
Declaration:Erdos405.erdos_405
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 10, later ones: 2; accepted critique: up to 60
Statement hash:424c14f69df83f3f4344fa122403fbb8e5e3ff0d4863dc8bfdfb8b54668539a4
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/ErdosProblems/405.lean

Formal statement

theorem erdos_405 :
    Set.Finite { x : ℕ × ℕ × ℕ | let (a, k, p) := x; p.Prime ∧ Odd p ∧
      Nat.factorial (p - 1) + a ^ (p - 1) = p ^ k}
Show the full Challenge.lean (101 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Erdős Problem 405

*References:*
- [erdosproblems.com/405](https://www.erdosproblems.com/405)
- [ErGr80] Erdős, P. and Graham, R., Old and new problems and results in combinatorial number
theory. Monographies de L'Enseignement Mathematique (1980)
- [BrEr91] Brindza, B. and Erdős, P., On some {D}iophantine problems involving powers and
factorials. J. Austral. Math. Soc. Ser. A (1991), 1--7.
- [YuLi96] Yu, Kunrui and Liu, Dehua, A complete resolution of a problem of {E}rdős and {G}raham.
Rocky Mountain J. Math. (1996), 1235--1244.
-/

@[expose] public section

open scoped Nat

namespace Erdos405

/--
Let $p$ be an odd prime. Is it true that the equation $(p-1)!+a^{p-1}=p^k$ has only finitely many
solutions?

Originally proposed by Erdős and Graham [ErGr80].
Brindza and Erdős [BrEr91] proved that there are finitely many such solutions.
-/
@[category research solved, AMS 11]
theorem erdos_405 :
    Set.Finite { x : ℕ × ℕ × ℕ | let (a, k, p) := x; p.Prime ∧ Odd p ∧
      Nat.factorial (p - 1) + a ^ (p - 1) = p ^ k} := by
  sorry

/--
Erdős and Graham [ErGr80] ask this allowing $p=2$, but this is presumably an oversight, since clearly
there are infinitely many solutions when $p=2$.

Observe that this creates $1! + a = 2^k$. For all $k$, fix $a = 2^k - 1$.
-/
@[category textbook, AMS 11]
theorem erdos_405.variants.nonodd_p :
    Set.Infinite { x : ℕ × ℕ × ℕ | let (a, k, p) := x; p.Prime ∧
      Nat.factorial (p - 1) + a ^ (p - 1) = p ^ k} := by
  -- Provide the infinite family of solutions
  apply Set.infinite_of_injective_forall_mem (f := fun k ↦ (2^k - 1, k, 2))
  · -- 1. Prove the function is injective
    intro x y h
    -- Simplify the tuple equality to individual components
    simp only [Prod.mk.injEq] at h
    -- The second component equality is exactly x = y
    exact h.2.1
  · -- 2. Prove all generated tuples belong to the set
    intro k
    simp only [Set.mem_ofPred_eq]
    -- Split into proving p is prime and the equation holds
    refine ⟨Nat.prime_two, ?_⟩
    -- Since p = 2, 2 - 1 = 1, so the equation simplifies definitionally
    change 1 + (2^k - 1)^1 = 2^k
    rw [pow_one]
    -- Prove 2^k is strictly positive so that (2^k - 1) doesn't underflow in Nat
    have h : 0 < 2^k := by positivity
    -- omega handles the Presburger arithmetic
    omega

/--
Yu and Liu [YuLi96] showed that the only solutions to $(p-1)! + a^(p-1) = p^k$
for an odd prime p are:
$$
2! + 1^2 = 3\\
2! + 5^2 = 3^3\\
4! + 1^4 = 5^2
$$
-/
@[category research solved, AMS 11]
theorem erdos_405.variants.yu_liu :
    { x : ℕ × ℕ × ℕ | let (a, k, p) := x; p.Prime ∧ Odd p ∧
      Nat.factorial (p - 1) + a ^ (p - 1) = p ^ k } =
    {(1, 1, 3), (5, 3, 3), (1, 2, 5)} := by
  sorry

end Erdos405

To prove it: keep every definition of Challenge.lean unchanged and prove Erdos405.erdos_405 with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_erdos_405 : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry fetch erdos-405
nosorry submit erdos-405 nosorry/erdos-405/Solution.lean --wait

Formal variants

Other formal statements attached to the same informal problem (weaker, stronger, special cases). Each is scored separately.

Contributions

No contributions yet — be the first. Submit a proof or a finding.

Research in progress

People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.

Nobody has shared research on this problem yet.

Sign in to share your research.

Statement review

Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.

Sign in to open a critique.