/-
Copyright 2025 The Formal Conjectures Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/
import FormalConjecturesUtilErdős Problem 304
Reference: erdosproblems.com/304
open Asymptotics Filternamespace Erdos304
The set of k for which a / b can be expressed as a sum of k distinct unit fractions.
def unitFractionExpressible (a b : ℕ) : Set ℕ :=
{k | ∃ s : Finset ℕ, s.card = k ∧ (∀ n ∈ s, n > 1) ∧ (a / b : ℚ) = ∑ n ∈ s, (n : ℚ)⁻¹}@[category API, simp, AMS 11]
lemma zero_mem_unitFractionExpressible_iff {a b : ℕ} :
0 ∈ unitFractionExpressible a b ↔ a = 0 ∨ b = 0 := a:ℕb:ℕ⊢ 0 ∈ unitFractionExpressible a b ↔ a = 0 ∨ b = 0
All goals completed! 🐙a:ℕb:ℕh✝:a = 0 ∨ b = 0this:↑a / ↑b = 0s:Finset ℕhs:∀ n ∈ s, 1 < nh:∀ i ∈ s, i = 0⊢ ∀ (x : ℕ), x ∉ s
intro i hi a:ℕb:ℕh✝:a = 0 ∨ b = 0this:↑a / ↑b = 0s:Finset ℕhs:∀ n ∈ s, 1 < nh:∀ i ∈ s, i = 0i:ℕhi:i ∈ s⊢ False
linarith [h i hi, hs i hi] All goals completed! 🐙@[category API, AMS 11]
lemma unitFractionExpressible_zero_left {b : ℕ} :
unitFractionExpressible 0 b = {0} := unitFractionExpressible_of_zero (by b:ℕ⊢ 0 = 0 ∨ b = 0 simp All goals completed! 🐙)@[category API, AMS 11]
lemma unitFractionExpressible_zero_right {a : ℕ} :
unitFractionExpressible a 0 = {0} := unitFractionExpressible_of_zero (by a:ℕ⊢ a = 0 ∨ 0 = 0 simp All goals completed! 🐙)@[category API, AMS 11]
lemma zero_notMem_unitFractionExpressible {a b : ℕ} :
0 ∉ unitFractionExpressible a b ↔ a ≠ 0 ∧ b ≠ 0 := by a:ℕb:ℕ⊢ 0 ∉ unitFractionExpressible a b ↔ a ≠ 0 ∧ b ≠ 0
simp_all [unitFractionExpressible] All goals completed! 🐙@[category API, AMS 11]
lemma eq_inv_of_one_mem_unitFractionExpressible {a b : ℕ}
(h : 1 ∈ unitFractionExpressible a b) : ∃ m : ℕ, 1 < m ∧ (a / b : ℚ) = (m : ℚ)⁻¹ := by a:ℕb:ℕh:1 ∈ unitFractionExpressible a b⊢ ∃ m, 1 < m ∧ ↑a / ↑b = (↑m)⁻¹
simp only [unitFractionExpressible, gt_iff_lt, Set.mem_ofPred_eq, Finset.card_eq_one] at h a:ℕb:ℕh:∃ s, (∃ a, s = {a}) ∧ (∀ n ∈ s, 1 < n) ∧ ↑a / ↑b = ∑ n ∈ s, (↑n)⁻¹⊢ ∃ m, 1 < m ∧ ↑a / ↑b = (↑m)⁻¹
obtain ⟨_, ⟨m, rfl⟩, h₁, h₂⟩ := h a:ℕb:ℕm:ℕh₁:∀ n ∈ {m}, 1 < nh₂:↑a / ↑b = ∑ n ∈ {m}, (↑n)⁻¹⊢ ∃ m, 1 < m ∧ ↑a / ↑b = (↑m)⁻¹
simp only [Finset.mem_singleton, forall_eq, Finset.sum_singleton] at h₁ h₂ a:ℕb:ℕm:ℕh₁:1 < mh₂:↑a / ↑b = (↑m)⁻¹⊢ ∃ m, 1 < m ∧ ↑a / ↑b = (↑m)⁻¹
use m All goals completed! 🐙
@[category API, AMS 11]
lemma dvd_of_one_mem_unitFractionExpressible {a b : ℕ}
(h : 1 ∈ unitFractionExpressible a b) : a ∣ b := by a:ℕb:ℕh:1 ∈ unitFractionExpressible a b⊢ a ∣ b
obtain ⟨m, hm₁, hm⟩ := eq_inv_of_one_mem_unitFractionExpressible h a:ℕb:ℕh:1 ∈ unitFractionExpressible a bm:ℕhm₁:1 < mhm:↑a / ↑b = (↑m)⁻¹⊢ a ∣ b
have : b ≠ 0 := by
rintro rfl a:ℕm:ℕhm₁:1 < mh:1 ∈ unitFractionExpressible a 0hm:↑a / ↑0 = (↑m)⁻¹⊢ False a:ℕb:ℕh:1 ∈ unitFractionExpressible a bm:ℕhm₁:1 < mhm:↑a / ↑b = (↑m)⁻¹this:b ≠ 0⊢ a ∣ b
simp [eq_comm] at hm a:ℕm:ℕhm₁:1 < mh:1 ∈ unitFractionExpressible a 0hm:m = 0⊢ False a:ℕb:ℕh:1 ∈ unitFractionExpressible a bm:ℕhm₁:1 < mhm:↑a / ↑b = (↑m)⁻¹this:b ≠ 0⊢ a ∣ b
omega a:ℕb:ℕh:1 ∈ unitFractionExpressible a bm:ℕhm₁:1 < mhm:↑a / ↑b = (↑m)⁻¹this:b ≠ 0⊢ a ∣ b a:ℕb:ℕh:1 ∈ unitFractionExpressible a bm:ℕhm₁:1 < mhm:↑a / ↑b = (↑m)⁻¹this:b ≠ 0⊢ a ∣ b
use m h a:ℕb:ℕh:1 ∈ unitFractionExpressible a bm:ℕhm₁:1 < mhm:↑a / ↑b = (↑m)⁻¹this:b ≠ 0⊢ b = a * m
field_simp at hm h a:ℕb:ℕh:1 ∈ unitFractionExpressible a bm:ℕhm₁:1 < mthis:b ≠ 0hm:↑a * ↑m = ↑b⊢ b = a * m
exact mod_cast hm.symm All goals completed! 🐙
Let $$N(a, b)$$, denoted here by smallestCollection a b be the minimal k such that there
exist integers $1 < n_1 < n_2 < \dots < n_k$ with
$$\frac{a}{b} = \sum_{i=1}^k \frac{1}{n_i}$$
noncomputable def smallestCollection (a b : ℕ) : ℕ := sInf (unitFractionExpressible a b)
-- in fact `(unitFractionExpressible a b).Nonempty` should always be true, but we do not prove it
-- for now
@[category API, AMS 11]
lemma smallestCollection_pos {a b : ℕ} (ha : a ≠ 0) (hb : b ≠ 0)
(h : (unitFractionExpressible a b).Nonempty) :
0 < smallestCollection a b := by a:ℕb:ℕha:a ≠ 0hb:b ≠ 0h:(unitFractionExpressible a b).Nonempty⊢ 0 < smallestCollection a b
suffices smallestCollection a b ≠ 0 by a:ℕb:ℕha:a ≠ 0hb:b ≠ 0h:(unitFractionExpressible a b).Nonemptythis:smallestCollection a b ≠ 0⊢ 0 < smallestCollection a b a:ℕb:ℕha:a ≠ 0hb:b ≠ 0h:(unitFractionExpressible a b).Nonempty⊢ smallestCollection a b ≠ 0 omega a:ℕb:ℕha:a ≠ 0hb:b ≠ 0h:(unitFractionExpressible a b).Nonempty⊢ smallestCollection a b ≠ 0 a:ℕb:ℕha:a ≠ 0hb:b ≠ 0h:(unitFractionExpressible a b).Nonempty⊢ smallestCollection a b ≠ 0
intro h' a:ℕb:ℕha:a ≠ 0hb:b ≠ 0h:(unitFractionExpressible a b).Nonemptyh':smallestCollection a b = 0⊢ False
have : 0 ∈ unitFractionExpressible a b := h' ▸ Nat.sInf_mem h a:ℕb:ℕha:a ≠ 0hb:b ≠ 0h:(unitFractionExpressible a b).Nonemptyh':smallestCollection a b = 0this:0 ∈ unitFractionExpressible a b⊢ False
simp_all All goals completed! 🐙
@[category API, AMS 11]
lemma smallestCollection_left_one (b : ℕ) (hb : 1 < b) : smallestCollection 1 b = 1 := by b:ℕhb:1 < b⊢ smallestCollection 1 b = 1
have : 1 ∈ unitFractionExpressible 1 b := ⟨{b}, by b:ℕhb:1 < b⊢ {b}.card = 1 ∧ (∀ n ∈ {b}, n > 1) ∧ ↑1 / ↑b = ∑ n ∈ {b}, (↑n)⁻¹ b:ℕhb:1 < bthis:1 ∈ unitFractionExpressible 1 b⊢ smallestCollection 1 b = 1 simpa All goals completed! 🐙 b:ℕhb:1 < bthis:1 ∈ unitFractionExpressible 1 b⊢ smallestCollection 1 b = 1⟩ b:ℕhb:1 < bthis:1 ∈ unitFractionExpressible 1 b⊢ smallestCollection 1 b = 1
have : smallestCollection 1 b ≤ 1 := Nat.sInf_le this b:ℕhb:1 < bthis✝:1 ∈ unitFractionExpressible 1 bthis:smallestCollection 1 b ≤ 1⊢ smallestCollection 1 b = 1
have : 0 ∉ unitFractionExpressible 1 b := by simp b:ℕhb:1 < bthis✝:1 ∈ unitFractionExpressible 1 bthis:smallestCollection 1 b ≤ 1⊢ ¬b = 0 b:ℕhb:1 < bthis✝¹:1 ∈ unitFractionExpressible 1 bthis✝:smallestCollection 1 b ≤ 1this:0 ∉ unitFractionExpressible 1 b⊢ smallestCollection 1 b = 1; omega b:ℕhb:1 < bthis✝¹:1 ∈ unitFractionExpressible 1 bthis✝:smallestCollection 1 b ≤ 1this:0 ∉ unitFractionExpressible 1 b⊢ smallestCollection 1 b = 1 b:ℕhb:1 < bthis✝¹:1 ∈ unitFractionExpressible 1 bthis✝:smallestCollection 1 b ≤ 1this:0 ∉ unitFractionExpressible 1 b⊢ smallestCollection 1 b = 1
have : smallestCollection 1 b ≠ 0 := ne_of_mem_of_not_mem (Nat.sInf_mem ⟨_, ‹_›⟩) this b:ℕhb:1 < bthis✝²:1 ∈ unitFractionExpressible 1 bthis✝¹:smallestCollection 1 b ≤ 1this✝:0 ∉ unitFractionExpressible 1 bthis:smallestCollection 1 b ≠ 0⊢ smallestCollection 1 b = 1
omega All goals completed! 🐙@[category API, AMS 11]
lemma eq_one_of_smallestCollection_eq_one {a b : ℕ}
(h : smallestCollection a b = 1) : ∃ m : ℕ, 1 < m ∧ (a / b : ℚ) = (m : ℚ)⁻¹ := by a:ℕb:ℕh:smallestCollection a b = 1⊢ ∃ m, 1 < m ∧ ↑a / ↑b = (↑m)⁻¹
have : 1 ∈ unitFractionExpressible a b := h ▸ Nat.sInf_mem (Nat.nonempty_of_sInf_eq_succ h) a:ℕb:ℕh:smallestCollection a b = 1this:1 ∈ unitFractionExpressible a b⊢ ∃ m, 1 < m ∧ ↑a / ↑b = (↑m)⁻¹
apply eq_inv_of_one_mem_unitFractionExpressible this All goals completed! 🐙@[category API, AMS 11]
lemma dvd_of_smallestCollection_eq_one {a b : ℕ}
(h : smallestCollection a b = 1) : a ∣ b := by a:ℕb:ℕh:smallestCollection a b = 1⊢ a ∣ b
have : 1 ∈ unitFractionExpressible a b := h ▸ Nat.sInf_mem (Nat.nonempty_of_sInf_eq_succ h) a:ℕb:ℕh:smallestCollection a b = 1this:1 ∈ unitFractionExpressible a b⊢ a ∣ b
apply dvd_of_one_mem_unitFractionExpressible this All goals completed! 🐙
@[category test, AMS 11]
lemma smallestCollection_two_fifteen : smallestCollection 2 15 = 2 := by ⊢ smallestCollection 2 15 = 2
have h : 2 ∈ unitFractionExpressible 2 15 := by
use {10, 30} h ⊢ {10, 30}.card = 2 ∧ (∀ n ∈ {10, 30}, n > 1) ∧ ↑2 / ↑15 = ∑ n ∈ {10, 30}, (↑n)⁻¹ h:2 ∈ unitFractionExpressible 2 15⊢ smallestCollection 2 15 = 2
norm_num [Finset.card_insert_of_notMem, Finset.card_singleton] h:2 ∈ unitFractionExpressible 2 15⊢ smallestCollection 2 15 = 2 h:2 ∈ unitFractionExpressible 2 15⊢ smallestCollection 2 15 = 2
have : smallestCollection 2 15 ≤ 2 := Nat.sInf_le h h:2 ∈ unitFractionExpressible 2 15this:smallestCollection 2 15 ≤ 2⊢ smallestCollection 2 15 = 2
have : 0 < smallestCollection 2 15 := smallestCollection_pos (by h:2 ∈ unitFractionExpressible 2 15this:smallestCollection 2 15 ≤ 2⊢ 2 ≠ 0 h:2 ∈ unitFractionExpressible 2 15this✝:smallestCollection 2 15 ≤ 2this:0 < smallestCollection 2 15⊢ smallestCollection 2 15 = 2 simp All goals completed! 🐙 h:2 ∈ unitFractionExpressible 2 15this✝:smallestCollection 2 15 ≤ 2this:0 < smallestCollection 2 15⊢ smallestCollection 2 15 = 2) (by h:2 ∈ unitFractionExpressible 2 15this:smallestCollection 2 15 ≤ 2⊢ 15 ≠ 0 h:2 ∈ unitFractionExpressible 2 15this✝:smallestCollection 2 15 ≤ 2this:0 < smallestCollection 2 15⊢ smallestCollection 2 15 = 2 simp All goals completed! 🐙 h:2 ∈ unitFractionExpressible 2 15this✝:smallestCollection 2 15 ≤ 2this:0 < smallestCollection 2 15⊢ smallestCollection 2 15 = 2) ⟨_, h⟩ h:2 ∈ unitFractionExpressible 2 15this✝:smallestCollection 2 15 ≤ 2this:0 < smallestCollection 2 15⊢ smallestCollection 2 15 = 2
have : smallestCollection 2 15 ≠ 1 := by
intro h' h:2 ∈ unitFractionExpressible 2 15this✝:smallestCollection 2 15 ≤ 2this:0 < smallestCollection 2 15h':smallestCollection 2 15 = 1⊢ False h:2 ∈ unitFractionExpressible 2 15this✝¹:smallestCollection 2 15 ≤ 2this✝:0 < smallestCollection 2 15this:smallestCollection 2 15 ≠ 1⊢ smallestCollection 2 15 = 2
have := dvd_of_smallestCollection_eq_one h' h:2 ∈ unitFractionExpressible 2 15this✝¹:smallestCollection 2 15 ≤ 2this✝:0 < smallestCollection 2 15h':smallestCollection 2 15 = 1this:2 ∣ 15⊢ False h:2 ∈ unitFractionExpressible 2 15this✝¹:smallestCollection 2 15 ≤ 2this✝:0 < smallestCollection 2 15this:smallestCollection 2 15 ≠ 1⊢ smallestCollection 2 15 = 2
norm_num at this h:2 ∈ unitFractionExpressible 2 15this✝¹:smallestCollection 2 15 ≤ 2this✝:0 < smallestCollection 2 15this:smallestCollection 2 15 ≠ 1⊢ smallestCollection 2 15 = 2 h:2 ∈ unitFractionExpressible 2 15this✝¹:smallestCollection 2 15 ≤ 2this✝:0 < smallestCollection 2 15this:smallestCollection 2 15 ≠ 1⊢ smallestCollection 2 15 = 2
omega All goals completed! 🐙Write $$N(b) = max_{1 \leq a < b} N(a, b)$$.
noncomputable def smallestCollectionTo (b : ℕ) : ℕ :=
sSup {smallestCollection a b | a ∈ Finset.Ico 1 b}In 1950, Erdős [Er50c] proved the upper bound $$N(b) \ll \log b / \log \log b$$. [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.
@[category research solved, AMS 11]
theorem erdos_304.variants.upper_1950 :
(fun b => (smallestCollectionTo b : ℝ)) =O[atTop]
(fun b => Real.log b / Real.log (Real.log b)) := by ⊢ (fun b ↦ ↑(smallestCollectionTo b)) =O[atTop] fun b ↦ Real.log ↑b / Real.log (Real.log ↑b)
sorry All goals completed! 🐙In 1950, Erdős [Er50c] proved the lower bound $$\log \log b \ll N(b)$$. [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.
@[category research solved, AMS 11]
theorem erdos_304.variants.lower_1950 :
(fun b : ℕ => Real.log (Real.log b)) =O[atTop]
(fun b => (smallestCollectionTo b : ℝ)) := by ⊢ (fun b ↦ Real.log (Real.log ↑b)) =O[atTop] fun b ↦ ↑(smallestCollectionTo b)
sorry All goals completed! 🐙In 1985 Vose [Vo85] proved the upper bound $$N(b) \ll \sqrt{\log b}$$. [Vo85] Vose, Michael D., Egyptian fractions. Bull. London Math. Soc. (1985), 21-24.
@[category research solved, AMS 11]
theorem erdos_304.variants.upper_1985 :
(fun b => (smallestCollectionTo b : ℝ)) =O[atTop]
(fun b => Real.sqrt (Real.log b)) := by ⊢ (fun b ↦ ↑(smallestCollectionTo b)) =O[atTop] fun b ↦ √(Real.log ↑b)
sorry All goals completed! 🐙Is it true that $$N(b) \ll \log \log b$$?
@[category research open, AMS 11]
theorem upper_bound : answer(sorry) ↔
(fun b : ℕ => (smallestCollectionTo b : ℝ)) =O[atTop] (fun b : ℕ => Real.log (Real.log b)) := by ⊢ True ↔ (fun b ↦ ↑(smallestCollectionTo b)) =O[atTop] fun b ↦ Real.log (Real.log ↑b)
sorry All goals completed! 🐙end Erdos304