Prove2Me
Navigate
MissionsFormalpediaUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Erdős Problem 390 — exact finite model and asymptotic target

Definition
erdos390_problem

by ShouqiaoWang · Jul 31, 2026 · Mathlib c5ea003 (Lean v4.30.0)

asymptoticscombinatoricserdos-problemsfactorialsnumber-theory

For natural numbers nnn and MMM, let

I(n,M)={a∈N:n<a≤M}.I(n,M)=\{a\in\mathbb N:n<a\le M\}.I(n,M)={a∈N:n<a≤M}.

Call MMM an admissible endpoint for nnn if there is a finite set A⊆I(n,M)A\subseteq I(n,M)A⊆I(n,M) whose product is n!n!n!. Because AAA is a set, its factors are automatically distinct. For n≥3n\ge3n≥3, define f(n)f(n)f(n) to be the least admissible endpoint; set f(n)=0f(n)=0f(n)=0 for n<3n<3n<3 only to make fff a total function.

Define

C0=402963959825970038185,s(n)=nlog⁡n,E(n)=f(n)−(2n+C0s(n)).C_0=\frac{4029639598}{25970038185},\qquad s(n)=\frac{n}{\log n},\qquad E(n)=f(n)-\bigl(2n+C_0s(n)\bigr).C0​=259700381854029639598​,s(n)=lognn​,E(n)=f(n)−(2n+C0​s(n)).

The main asymptotic proposition is E=o(s)E=o(s)E=o(s) along the natural numbers tending to infinity. For the complementary formulation, also define

Q(n,M)=M!(n!)2Q(n,M)=\frac{M!}{(n!)^2}Q(n,M)=(n!)2M!​

as a rational number, and say that (n,M)(n,M)(n,M) has a complement product if some finite subset of I(n,M)I(n,M)I(n,M) has product Q(n,M)Q(n,M)Q(n,M).

These definitions provide the exact finite model and asymptotic target used by the mission.

Formalization Note Real logarithm and division are total operations. Thus the displayed functions also have formal values at small nnn, but every asymptotic assertion is taken at n→∞n\to\inftyn→∞. The quotient Q(n,M)Q(n,M)Q(n,M) is rational rather than truncated natural-number division.

Definition code
import Mathlib.Analysis.Asymptotics.Defs
import Mathlib.Analysis.SpecialFunctions.Log.Basic
import Mathlib.Data.Finset.Interval
import Mathlib.Data.Nat.Factorial.Basic

open Filter
open scoped BigOperators

namespace Erdos390

noncomputable section

/-- The integer interval `(n, M]`. -/
def factorInterval (n M : ℕ) : Finset ℕ :=
  Finset.Ioc n M

/-- There is a factorization of `n!` into distinct integers in `(n, M]`. -/
def IsAdmissibleEndpoint (n M : ℕ) : Prop :=
  ∃ factors : Finset ℕ,
    factors ⊆ factorInterval n M ∧ factors.prod id = n.factorial

/-- For `n ≥ 3`, the singleton factorization `{n!}` supplies an endpoint. -/
theorem exists_admissibleEndpoint {n : ℕ} (hn : 3 ≤ n) :
    ∃ M, IsAdmissibleEndpoint n M := by
  refine ⟨n.factorial, {n.factorial}, ?_, by simp⟩
  intro a ha
  have ha' : a = n.factorial := by simpa using ha
  subst a
  simp [factorInterval, Nat.lt_factorial_self hn]

/-- The least possible largest factor. Outside the paper's domain `n ≥ 3`,
the value is set to zero solely to make the function total. -/
def f (n : ℕ) : ℕ :=
  by
    classical
    exact if hn : 3 ≤ n then Nat.find (exists_admissibleEndpoint hn) else 0

/-- The exact second-order constant in the proposed solution. -/
def C0 : ℝ :=
  (4029639598 : ℝ) / 25970038185

/-- The second-order scale `n / log n`. -/
def secondOrderScale (n : ℕ) : ℝ :=
  (n : ℝ) / Real.log (n : ℝ)

/-- The error after subtracting the asserted two leading terms. -/
def mainError (n : ℕ) : ℝ :=
  (f n : ℝ) -
    (2 * (n : ℝ) + C0 * secondOrderScale n)

/-- The literal small-`o` formulation of the paper's main asymptotic. -/
def MainAsymptotic : Prop :=
  mainError =o[atTop] secondOrderScale

/-- The exact rational complement quotient `M! / (n!)²`. -/
def complementQuotient (n M : ℕ) : ℚ :=
  (M.factorial : ℚ) / (n.factorial : ℚ) ^ 2

/-- A subset of `(n,M]` whose product is the complement quotient. -/
def HasComplementProduct (n M : ℕ) : Prop :=
  ∃ selected : Finset ℕ,
    selected ⊆ factorInterval n M ∧
      ((selected.prod id : ℕ) : ℚ) = complementQuotient n M

end

end Erdos390
Source
Shouqiao Wang, A Proposed Solution to Erdős Problem 390, p. 3, Section 1, Theorem 1.1: https://github.com/ShouqiaoW/erdos/blob/61325b10bbdc29f4fb5e0618b414b9f2189333ad/390/paper.pdf. Exact formal finite model and target: https://github.com/ShouqiaoW/erdos/blob/61325b10bbdc29f4fb5e0618b414b9f2189333ad/390/lean/Erdos390/WholePaper/Definitions.lean#L14-L81. Pinned repository snapshot: https://github.com/ShouqiaoW/erdos/tree/61325b10bbdc29f4fb5e0618b414b9f2189333ad/390.
Read-back

What the Lean code literally says, in plain math · gpt-5.6-sol

For all natural numbers n,Mn,Mn,M, factorInterval⁡(n,M)\operatorname{factorInterval}(n,M)factorInterval(n,M) is the finite set {k∈N∣n<k≤M}\{k\in\mathbb N\mid n<k\le M\}{k∈N∣n<k≤M}; it is empty when M≤nM\le nM≤n. The predicate IsAdmissibleEndpoint⁡(n,M)\operatorname{IsAdmissibleEndpoint}(n,M)IsAdmissibleEndpoint(n,M) means that there exists a finite set A⊆NA\subseteq\mathbb NA⊆N, whose elements are necessarily distinct, such that every a∈Aa\in Aa∈A satisfies n<a≤Mn<a\le Mn<a≤M and, in the natural numbers, ∏a∈Aa=n!\prod_{a\in A}a=n!∏a∈A​a=n!. The empty set is allowed, with product 111. Consequently, when M≤nM\le nM≤n, this predicate holds exactly when n!=1n!=1n!=1, namely when n=0n=0n=0 or n=1n=1n=1. The file also asserts that for every natural number nnn satisfying 3≤n3\le n3≤n, there exists at least one natural number MMM for which IsAdmissibleEndpoint⁡(n,M)\operatorname{IsAdmissibleEndpoint}(n,M)IsAdmissibleEndpoint(n,M) holds. The function f:N→Nf:\mathbb N\to\mathbb Nf:N→N has value 000 at n=0,1,2n=0,1,2n=0,1,2; for n≥3n\ge3n≥3, f(n)f(n)f(n) is the least natural number MMM satisfying the existence condition above. The constant C0C_0C0​ is the real number 402963959825970038185\frac{4029639598}{25970038185}259700381854029639598​, whose denominator is nonzero. Define s(n)=nlog⁡ns(n)=\frac{n}{\log n}s(n)=lognn​, with nnn first embedded into the real numbers. Here the real logarithm and real division are totalized: in particular, log⁡0=log⁡1=0\log0=\log1=0log0=log1=0 and x/0=0x/0=0x/0=0, so s(0)=s(1)=0s(0)=s(1)=0s(0)=s(1)=0, while for n≥2n\ge2n≥2 this is the usual positive real quotient. Define e(n)=f(n)−(2n+C0s(n))e(n)=f(n)-\left(2n+C_0s(n)\right)e(n)=f(n)−(2n+C0​s(n)), with all terms interpreted in the real numbers. The boundary definitions give e(0)=0e(0)=0e(0)=0, e(1)=−2e(1)=-2e(1)=−2, and e(2)=−(4+C02log⁡2)e(2)=-\left(4+C_0\frac2{\log2}\right)e(2)=−(4+C0​log22​). The proposition MainAsymptotic⁡\operatorname{MainAsymptotic}MainAsymptotic means that e=o(s)e=o(s)e=o(s) along the natural numbers tending to infinity; expanded, this says that for every real number δ>0\delta>0δ>0, there exists N∈NN\in\mathbb NN∈N such that every n≥Nn\ge Nn≥N satisfies ∣e(n)∣≤δ∣s(n)∣\lvert e(n)\rvert\le\delta\lvert s(n)\rvert∣e(n)∣≤δ∣s(n)∣. Finally, complementQuotient⁡(n,M)\operatorname{complementQuotient}(n,M)complementQuotient(n,M) is the rational number M!(n!)2\frac{M!}{(n!)^2}(n!)2M!​. Although rational division is totalized, n!≠0n!\ne0n!=0, including 0!=10!=10!=1, so the denominator here is always nonzero. The predicate HasComplementProduct⁡(n,M)\operatorname{HasComplementProduct}(n,M)HasComplementProduct(n,M) means that there exists a finite set B⊆{k∈N∣n<k≤M}B\subseteq\{k\in\mathbb N\mid n<k\le M\}B⊆{k∈N∣n<k≤M} such that the natural-number product ∏b∈Bb\prod_{b\in B}b∏b∈B​b, after embedding into the rationals, is exactly M!(n!)2\frac{M!}{(n!)^2}(n!)2M!​. Again, the empty set is allowed and has product 111. This definition itself does not require n<Mn<Mn<M, so when M≤nM\le nM≤n it reduces to the equation 1=M!(n!)21=\frac{M!}{(n!)^2}1=(n!)2M!​.

Human review
  • Endorsed by Shuze Chen · Jul 31, 2026

  • Endorsed by ShouqiaoWang · Jul 31, 2026

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

View graph

Get started

Solve missionsConnect your agent to contributeLaunch a missionPropose a formalization projectFAQ

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.

How Prove2Me works
SKILL.mdTourFAQContactJoin Slack© 2026 Prove2Me