{
  "id": "1641",
  "ident": "NS.01641",
  "slug": "erdos-304--upper-bound",
  "title": "Erdős Problem 304 · upper_bound",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Is it true that $$N(b) \\ll \\log \\log b$$?\n\nYes. This was proved by an internal OpenAI model in September 2026 [OAI26a]; see the linked\nLean proof.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question",
    "formal_proof"
  ],
  "collection": "erdos",
  "source_url": "https://www.erdosproblems.com/304",
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos304.upper_bound",
  "statement_lean": "theorem upper_bound :\n    (fun b : ℕ => (smallestCollectionTo b : ℝ)) =O[atTop] (fun b : ℕ => Real.log (Real.log b))",
  "challenge_source": "/-\nCopyright 2025 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\n\n/-!\n# Erdős Problem 304\n*Reference:* [erdosproblems.com/304](https://www.erdosproblems.com/304)\n\n[OAI26a] OpenAI, *Short Egyptian fractions*. OpenAI Math Release preprint (2026).\nhttps://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/preprints/Short-Egyptian-fractions-September-25-2026/Short-Egyptian-fractions-September-25-2026.pdf\n-/\n\n@[expose] public section\n\nopen Asymptotics Filter\n\nnamespace Erdos304\n\n/--\nThe set of `k` for which `a / b` can be expressed as a sum of `k` distinct unit fractions.\n-/\ndef unitFractionExpressible (a b : ℕ) : Set ℕ :=\n  {k | ∃ s : Finset ℕ, s.card = k ∧ (∀ n ∈ s, n > 1) ∧ (a / b : ℚ) = ∑ n ∈ s, (n : ℚ)⁻¹}\n\n@[category API, simp, AMS 11]\nlemma zero_mem_unitFractionExpressible_iff {a b : ℕ} :\n    0 ∈ unitFractionExpressible a b ↔ a = 0 ∨ b = 0 := by\n  simp_all [unitFractionExpressible]\n\n@[category API, AMS 11]\nlemma unitFractionExpressible_of_zero {a b : ℕ} (h : a = 0 ∨ b = 0) :\n    unitFractionExpressible a b = {0} := by\n  simp only [Set.eq_singleton_iff_unique_mem, zero_mem_unitFractionExpressible_iff, *]\n  have : (a / b : ℚ) = 0 := by simpa\n  simp only [unitFractionExpressible, gt_iff_lt, Set.mem_ofPred_eq, forall_exists_index, and_imp,\n    true_and, this]\n  rintro _ s rfl hs h\n  rw [eq_comm, Finset.sum_eq_zero_iff_of_nonneg (fun i hi ↦ by positivity)] at h\n  simp only [inv_eq_zero, Nat.cast_eq_zero] at h\n  rw [Finset.card_eq_zero, Finset.eq_empty_iff_forall_notMem]\n  intro i hi\n  linarith [h i hi, hs i hi]\n\n@[category API, AMS 11]\nlemma unitFractionExpressible_zero_left {b : ℕ} :\n    unitFractionExpressible 0 b = {0} := unitFractionExpressible_of_zero (by simp)\n\n@[category API, AMS 11]\nlemma unitFractionExpressible_zero_right {a : ℕ} :\n    unitFractionExpressible a 0 = {0} := unitFractionExpressible_of_zero (by simp)\n\n@[category API, AMS 11]\nlemma zero_notMem_unitFractionExpressible {a b : ℕ} :\n    0 ∉ unitFractionExpressible a b ↔ a ≠ 0 ∧ b ≠ 0 := by\n  simp_all [unitFractionExpressible]\n\n@[category API, AMS 11]\nlemma eq_inv_of_one_mem_unitFractionExpressible {a b : ℕ}\n    (h : 1 ∈ unitFractionExpressible a b) : ∃ m : ℕ, 1 < m ∧ (a / b : ℚ) = (m : ℚ)⁻¹ := by\n  simp only [unitFractionExpressible, gt_iff_lt, Set.mem_ofPred_eq, Finset.card_eq_one] at h\n  obtain ⟨_, ⟨m, rfl⟩, h₁, h₂⟩ := h\n  simp only [Finset.mem_singleton, forall_eq, Finset.sum_singleton] at h₁ h₂\n  use m\n\n@[category API, AMS 11]\nlemma dvd_of_one_mem_unitFractionExpressible {a b : ℕ}\n    (h : 1 ∈ unitFractionExpressible a b) : a ∣ b := by\n  obtain ⟨m, hm₁, hm⟩ := eq_inv_of_one_mem_unitFractionExpressible h\n  have : b ≠ 0 := by\n    rintro rfl\n    simp [eq_comm] at hm\n    omega\n  use m\n  field_simp at hm\n  exact mod_cast hm.symm\n\n/-- Let $$N(a, b)$$, denoted here by `smallestCollection a b` be the minimal k such that there\nexist integers $1 < n_1 < n_2 < \\dots < n_k$ with\n$$\\frac{a}{b} = \\sum_{i=1}^k \\frac{1}{n_i}$$ -/\nnoncomputable def smallestCollection (a b : ℕ) : ℕ := sInf (unitFractionExpressible a b)\n\n-- in fact `(unitFractionExpressible a b).Nonempty` should always be true, but we do not prove it\n-- for now\n@[category API, AMS 11]\nlemma smallestCollection_pos {a b : ℕ} (ha : a ≠ 0) (hb : b ≠ 0)\n    (h : (unitFractionExpressible a b).Nonempty) :\n    0 < smallestCollection a b := by\n  suffices smallestCollection a b ≠ 0 by omega\n  intro h'\n  have : 0 ∈ unitFractionExpressible a b := h' ▸ Nat.sInf_mem h\n  simp_all\n\n@[category API, AMS 11]\nlemma smallestCollection_left_one (b : ℕ) (hb : 1 < b) : smallestCollection 1 b = 1 := by\n  have : 1 ∈ unitFractionExpressible 1 b := ⟨{b}, by simpa⟩\n  have : smallestCollection 1 b ≤ 1 := Nat.sInf_le this\n  have : 0 ∉ unitFractionExpressible 1 b := by simp; omega\n  have : smallestCollection 1 b ≠ 0 := ne_of_mem_of_not_mem (Nat.sInf_mem ⟨_, ‹_›⟩) this\n  omega\n\n@[category API, AMS 11]\nlemma eq_one_of_smallestCollection_eq_one {a b : ℕ}\n    (h : smallestCollection a b = 1) : ∃ m : ℕ, 1 < m ∧ (a / b : ℚ) = (m : ℚ)⁻¹ := by\n  have : 1 ∈ unitFractionExpressible a b := h ▸ Nat.sInf_mem (Nat.nonempty_of_sInf_eq_succ h)\n  apply eq_inv_of_one_mem_unitFractionExpressible this\n\n@[category API, AMS 11]\nlemma dvd_of_smallestCollection_eq_one {a b : ℕ}\n    (h : smallestCollection a b = 1) : a ∣ b := by\n  have : 1 ∈ unitFractionExpressible a b := h ▸ Nat.sInf_mem (Nat.nonempty_of_sInf_eq_succ h)\n  apply dvd_of_one_mem_unitFractionExpressible this\n\n@[category test, AMS 11]\nlemma smallestCollection_two_fifteen : smallestCollection 2 15 = 2 := by\n  have h : 2 ∈ unitFractionExpressible 2 15 := by\n    use {10, 30}\n    norm_num [Finset.card_insert_of_notMem, Finset.card_singleton]\n  have : smallestCollection 2 15 ≤ 2 := Nat.sInf_le h\n  have : 0 < smallestCollection 2 15 := smallestCollection_pos (by simp) (by simp) ⟨_, h⟩\n  have : smallestCollection 2 15 ≠ 1 := by\n    intro h'\n    have := dvd_of_smallestCollection_eq_one h'\n    norm_num at this\n  omega\n\n/-- Write $$N(b) = max_{1 \\leq a < b} N(a, b)$$. -/\nnoncomputable def smallestCollectionTo (b : ℕ) : ℕ :=\n  sSup {smallestCollection a b | a ∈ Finset.Ico 1 b}\n\n/--\nIn 1950, Erdős [Er50c] proved the upper bound $$N(b) \\ll \\log b / \\log \\log b$$.\n[Er50c] Erdős, P., Az ${1}/{x_1} + {1}/{x_2} + \\ldots + {1}/{x_n} =A/B$ egyenlet eg\\'{E}sz sz\\'{A}m\\'{u} megold\\'{A}sairól. Mat. Lapok (1950), 192-210.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_304.variants.upper_1950 :\n    (fun b => (smallestCollectionTo b : ℝ)) =O[atTop]\n      (fun b => Real.log b / Real.log (Real.log b)) := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nIn 1950, Erdős [Er50c] proved the lower bound $$\\log \\log b \\ll N(b)$$.\n[Er50c] Erdős, P., Az ${1}/{x_1} + {1}/{x_2} + \\ldots + {1}/{x_n} =A/B$ egyenlet eg\\'{E}sz sz\\'{A}m\\'{u} megold\\'{A}sairól. Mat. Lapok (1950), 192-210.\n-/\n@[category research solved, AMS 11, formal_proof using lean4 at \"https://github.com/thepriceisright/publications/blob/8f055eb3fd1485477c92cbfbdfa4b3c56f192610/erdos/304/Lower1950.lean\"]\ntheorem erdos_304.variants.lower_1950 :\n    (fun b : ℕ => Real.log (Real.log b)) =O[atTop]\n      (fun b => (smallestCollectionTo b : ℝ)) := by\n  sorry\n\n/--\nIn 1985 Vose [Vo85] proved the upper bound $$N(b) \\ll \\sqrt{\\log b}$$.\n[Vo85] Vose, Michael D., Egyptian fractions. Bull. London Math. Soc. (1985), 21-24.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_304.variants.upper_1985 :\n    (fun b => (smallestCollectionTo b : ℝ)) =O[atTop]\n      (fun b => Real.sqrt (Real.log b)) := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nIs it true that $$N(b) \\ll \\log \\log b$$?\n\nYes. This was proved by an internal OpenAI model in September 2026 [OAI26a]; see the linked\nLean proof.\n-/\n@[category research solved, question, AMS 11, formal_proof using lean4 at\n  \"https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/NumberTheory/ShortEgyptian/Main.lean#L33\"]\ntheorem upper_bound :\n    (fun b : ℕ => (smallestCollectionTo b : ℝ)) =O[atTop] (fun b : ℕ => Real.log (Real.log b)) := by\n  sorry\n\nend Erdos304\n",
  "statement_hash": "7bbcef7232af930d81814acb0d31c854f5619c43fd1632eee615fd557c0872fe",
  "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."
}