{
  "id": "1977",
  "ident": "NS.01977",
  "slug": "erdos-393",
  "title": "Erdős Problem 393",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Let $f(n)$ denote the minimal $m\\geq 1$ such that\n$$n! = a_1\\cdots a_t$$\nwith $a_1<\\cdots <a_t=a_1+m$. What is the behaviour of $f(n)$?\n\nWe formalise the question as: does $f(n) \\to \\infty$? A result of Luca [Lu02] implies a positive\nanswer, conditional on the $abc$ conjecture (see `Erdos393.erdos_393.variants.luca`).",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos393.erdos_393",
  "statement_lean": "theorem erdos_393 : Tendsto f atTop atTop",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\npublic import FormalConjectures.Wikipedia.ABC\n\n/-!\n# Erdős Problem 393\n\n*References:*\n- [erdosproblems.com/393](https://www.erdosproblems.com/393)\n- [ErGr80] Erdős, P. and Graham, R., *Old and new problems and results in combinatorial number\n  theory*. Monographies de L'Enseignement Mathematique (1980).\n- [BeOs92] Berend, Daniel and Osgood, Charles F., *On the equation $P(x)=n!$ and a question of\n  Erdős*. J. Number Theory 42 (1992), 189-193.\n- [BPZ23] Bui, Hung M. and Pratt, Kyle and Zaharescu, Alexandru, *Power savings for counting\n  solutions to polynomial-factorial equations*. Adv. Math. 422 (2023), Paper No. 109021, 32 pp.\n  [arXiv:2204.08423](https://arxiv.org/abs/2204.08423)\n- [Lu02] Luca, Florian, *The Diophantine equation $P(x)=n!$ and a result of M. Overholt*.\n  Glas. Mat. Ser. III 37 (2002), 269-273.\n- [OEIS A388302](https://oeis.org/A388302): the values $f(n)$ for $n \\geq 2$.\n-/\n\n@[expose] public section\n\nopen Filter Asymptotics\nopen scoped Nat\n\nnamespace Erdos393\n\n/--\n`f n` is $f(n)$, the minimal $m \\geq 1$ such that $n! = a_1 \\cdots a_t$ with\n$a_1 < \\cdots < a_t = a_1 + m$. The factors are recorded as a finite set\n$s \\subseteq [a, a + m]$ of natural numbers that contains $a = a_1$ and $a + m = a_t$. Since\n$m \\geq 1$ there are at least two factors, and they are positive because $n! \\neq 0$.\n\nSuch a factorisation exists for $n \\geq 2$. For $n \\leq 1$ there is none, since $n! = 1$, and\n`f n` is the junk value `0`.\n-/\nnoncomputable def f (n : ℕ) : ℕ :=\n  sInf {m : ℕ | 1 ≤ m ∧ ∃ a : ℕ, ∃ s ⊆ Finset.Icc a (a + m), a ∈ s ∧ a + m ∈ s ∧\n    ∏ i ∈ s, i = n !}\n\n/-- For $n \\geq 2$ the factorisation $n! = 1 \\cdot 2 \\cdots n$ exists, so `f n` is a true\nminimum and $f(n) \\geq 1$. -/\n@[category test, AMS 11]\ntheorem one_le_f (n : ℕ) (hn : 2 ≤ n) : 1 ≤ f n := by\n  have hprod : ∏ i ∈ Finset.Ico 1 (n + 1), i = n ! := Finset.prod_Ico_id_eq_factorial n\n  refine le_csInf ⟨n - 1, by omega, 1, Finset.Ico 1 (n + 1), ?_, ?_, ?_, hprod⟩ fun _ hm ↦ hm.1\n  · intro i hi\n    obtain ⟨h1, h2⟩ := Finset.mem_Ico.1 hi\n    exact Finset.mem_Icc.2 ⟨h1, by omega⟩\n  · exact Finset.mem_Ico.2 ⟨le_rfl, by omega⟩\n  · exact Finset.mem_Ico.2 ⟨by omega, by omega⟩\n\n/-- $3! = 2 \\cdot 3$, so $f(3) = 1$. -/\n@[category test, AMS 11]\ntheorem f_three : f 3 = 1 :=\n  le_antisymm (Nat.sInf_le ⟨le_rfl, 2, {2, 3}, by decide, by decide, by decide, by decide⟩)\n    (one_le_f 3 (by norm_num))\n\n/-- The factors need not be consecutive integers: $7! = 70 \\cdot 72$, so $f(7) \\leq 2$. -/\n@[category test, AMS 11]\ntheorem f_seven_le_two : f 7 ≤ 2 :=\n  Nat.sInf_le ⟨by norm_num, 70, {70, 72}, by decide, by decide, by decide, by decide⟩\n\n/-- The factorisation $n! = 2 \\cdot 3 \\cdots n$ shows that $f(n) \\leq n - 2$ for $n \\geq 3$. -/\n@[category test, AMS 11]\ntheorem f_le_sub_two (n : ℕ) (hn : 3 ≤ n) : f n ≤ n - 2 := by\n  have hprod : ∏ i ∈ Finset.Ico 2 (n + 1), i = n ! := by\n    have h := Finset.prod_eq_prod_Ico_succ_bot (show 1 < n + 1 by omega) (fun i ↦ i)\n    rw [Finset.prod_Ico_id_eq_factorial, one_mul] at h\n    exact h.symm\n  refine Nat.sInf_le ⟨by omega, 2, Finset.Ico 2 (n + 1), ?_, ?_, ?_, hprod⟩\n  · intro i hi\n    obtain ⟨h1, h2⟩ := Finset.mem_Ico.1 hi\n    exact Finset.mem_Icc.2 ⟨h1, by omega⟩\n  · exact Finset.mem_Ico.2 ⟨le_rfl, by omega⟩\n  · exact Finset.mem_Ico.2 ⟨by omega, by omega⟩\n\n/-- $1! = 1$ is not a product of two or more distinct positive integers, so `f 1` is the junk\nvalue `0`. -/\n@[category test, AMS 11]\ntheorem f_one : f 1 = 0 := by\n  refine Nat.sInf_eq_zero.2 (Or.inr (Set.eq_empty_of_forall_notMem ?_))\n  rintro m ⟨hm, a, s, -, ha, hb, hs⟩\n  have h1 : a ∣ ∏ i ∈ s, i := Finset.dvd_prod_of_mem (fun i ↦ i) ha\n  have h2 : a + m ∣ ∏ i ∈ s, i := Finset.dvd_prod_of_mem (fun i ↦ i) hb\n  rw [hs, Nat.factorial_one] at h1 h2\n  have ha1 := Nat.eq_one_of_dvd_one h1\n  have hb1 := Nat.eq_one_of_dvd_one h2\n  omega\n\n/--\nLet $f(n)$ denote the minimal $m\\geq 1$ such that\n$$n! = a_1\\cdots a_t$$\nwith $a_1<\\cdots <a_t=a_1+m$. What is the behaviour of $f(n)$?\n\nWe formalise the question as: does $f(n) \\to \\infty$? A result of Luca [Lu02] implies a positive\nanswer, conditional on the $abc$ conjecture (see `Erdos393.erdos_393.variants.luca`).\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_393 : Tendsto f atTop atTop := by\n  sorry\n\n/--\nErdős and Graham [ErGr80, p. 76] write that they do not even know whether $f(n) = 1$ for infinitely\nmany $n$, that is, whether a factorial is the product of two consecutive integers infinitely\noften.\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_393.variants.infinitely_often_one :\n    {n : ℕ | f n = 1}.Infinite := by\n  sorry\n\n/--\nLet $F_m(N)$ count the number of $n \\leq N$ such that $f(n) = m$. A theorem of Berend and\nOsgood [BeOs92] implies that, for each fixed $m$, $F_m(N) = o(N)$, that is,\n$\\{n : f(n) = m\\}$ has natural density $0$.\n\nThey proved that, for every $P \\in \\mathbb{Z}[x]$ of degree at least $2$, the set of $n$ such\nthat $P(x) = n!$ has an integer solution has density $0$. For $m \\geq 1$ this applies because\n$f(n) = m$ gives $n! = P(a_1)$ for one of the finitely many polynomials\n$P(x) = \\prod_{j \\in S} (x + j)$ with $\\{0, m\\} \\subseteq S \\subseteq \\{0, \\ldots, m\\}$. For\n$m = 0$ the set is $\\{0, 1\\}$ (the junk values), so the statement is trivial.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_393.variants.berend_osgood (m : ℕ) :\n    {n : ℕ | f n = m}.HasDensity 0 := by\n  sorry\n\n/--\nA theorem of Bui, Pratt, and Zaharescu [BPZ23] implies that, for each fixed $m$,\n$$F_m(N) \\ll_m N^{33/34},$$\nwhere $F_m(N)$ is the number of $n \\leq N$ such that $f(n) = m$.\n\nThey proved that, for every $P \\in \\mathbb{Z}[x]$ of degree at least $2$, the number of\n$N \\leq n < 2N$ such that $P(x) = n!$ has an integer solution is $\\ll_P N^{33/34}$. Summing over\nthe finitely many polynomials in `Erdos393.erdos_393.variants.berend_osgood` and over the dyadic\nranges $[2^i, 2^{i+1})$ gives the bound for $n \\leq N$.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_393.variants.bui_pratt_zaharescu (m : ℕ) :\n    (fun N : ℕ ↦ (({n : ℕ | f n = m} ∩ Set.Iic N).ncard : ℝ)) =O[atTop]\n      (fun N : ℕ ↦ (N : ℝ) ^ (33 / 34 : ℝ)) := by\n  sorry\n\n/--\nLuca [Lu02] proved that the $abc$ conjecture implies that, for every $P \\in \\mathbb{Z}[x]$ of\ndegree at least $2$, the equation $P(x) = n!$ has only finitely many solutions. As remarked on\nerdosproblems.com, this implies that $f(n) \\to \\infty$, conditional on the $abc$ conjecture\n(`ABC.abc`).\n-/\n@[category research solved, AMS 11, formal_proof using lean4 at\n  \"https://palomar-registry.org/entry.html?id=PALOMAR-2026-11-02-000011\"]\ntheorem erdos_393.variants.luca (habc : type_of% ABC.abc) : Tendsto f atTop atTop := by\n  sorry\n\nend Erdos393\n",
  "statement_hash": "cd0eb39372dda001eb232d950bea35dd2cbde490c6b2e0ac72001fbe5bf65a1d",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}