{
  "id": "1535",
  "ident": "NS.01535",
  "slug": "erdos-282",
  "title": "Erdős Problem 282",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Let $A\\subseteq \\mathbb{N}$ be an infinite set and consider the following\ngreedy algorithm for a rational $x\\in (0,1)$: choose the minimal $n\\in A$ not used\nso far such that $n\\geq 1/x$ and repeat with $x$ replaced by $x-\\frac{1}{n}$. If this\nterminates after finitely many steps then this produces a representation of\n$x$ as the sum of distinct unit fractions with denominators from $A$.\n\nDoes this process always terminate if $x$ has odd denominator and $A$ is the\nset of odd numbers?",
  "subjects": [
    "math.CO",
    "msc:05"
  ],
  "tags": [],
  "collection": "erdos",
  "source_url": "https://www.erdosproblems.com/282",
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos282.erdos_282",
  "statement_lean": "theorem erdos_282 {x : ℚ} (hx : x ∈ Set.Ioo 0 1) (hx_den : Odd x.den) :\n    greedyUnitFractionRem { n | Odd n } x =ᶠ[atTop] 0",
  "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 282\n\n*Reference:* [erdosproblems.com/282](https://www.erdosproblems.com/282)\n-/\n\n@[expose] public section\n\nopen Filter Real\n\nnamespace Erdos282\n\n/-- Let $A\\subseteq \\mathbb{N}$ be an infinite set and consider the following\ngreedy algorithm for a rational $x$: choose the minimal $n\\in A$ not used so far such\nthat $n\\geq 1/x$ and repeat with $x$ replaced by $x-\\frac{1}{n}$.\n\nThis process of subtracting unit fractions is modelled in `greedyUnitFractionRem`.\nAt each step `t : ℕ`, the function `greedyUnitFractionRem A x t` returns the remainder\nof `x` with respect to the first `t + 1` unit fractions, with distinct denominators taken\nfrom `A`. Once the remainder reaches `0` it stays `0`, and the process terminates. This\ncorresponds to producing a representation of `x` as the sum of distinct unit fractions with\ndenominators from `A`, however this function does not return this representation. -/\nnoncomputable def greedyUnitFractionRem (A : Set ℕ) (x : ℚ) (t : ℕ) : ℚ :=\n  if x ≤ 0 then 0 else\n    let n := sInf { n | n ∈ A ∧ 1 / x ≤ n }\n    let rem := x - 1 / n\n    match t with\n    | 0 => rem\n    | t + 1 => greedyUnitFractionRem (A \\ {n}) rem t\n\n@[category test, AMS 5]\ntheorem greedyUnitFractionRem_zero (n : ℕ) : greedyUnitFractionRem .univ (1 / n) 0 = 0 := by\n  simp [greedyUnitFractionRem, Set.Ici_def]\n\n@[category test, AMS 5]\ntheorem greedyUnitFractionRem_one (n : ℕ) : greedyUnitFractionRem .univ (1 / n) 1 = 0 := by\n  simp [greedyUnitFractionRem, Set.Ici_def]\n\n/-- Let $A\\subseteq \\mathbb{N}$ be an infinite set and consider the following\ngreedy algorithm for a rational $x\\in (0,1)$: choose the minimal $n\\in A$ not used\nso far such that $n\\geq 1/x$ and repeat with $x$ replaced by $x-\\frac{1}{n}$. If this\nterminates after finitely many steps then this produces a representation of\n$x$ as the sum of distinct unit fractions with denominators from $A$.\n\nDoes this process always terminate if $x$ has odd denominator and $A$ is the\nset of odd numbers? -/\n@[category research open, AMS 5]\ntheorem erdos_282 {x : ℚ} (hx : x ∈ Set.Ioo 0 1) (hx_den : Odd x.den) :\n    greedyUnitFractionRem { n | Odd n } x =ᶠ[atTop] 0 := by\n  sorry\n\ndef erdos_282.variants.general.answer : Set (ℚ × Set ℕ) := sorry\n\n/-- More generally, for which pairs $x$ and $A$ does this process terminate? -/\n@[category research open, question value, AMS 5]\ntheorem erdos_282.variants.general (x : ℚ) (A : Set ℕ) :\n      greedyUnitFractionRem A x =ᶠ[atTop] 0 ↔ (x, A) ∈ erdos_282.variants.general.answer := by\n  sorry\n\n/-- In 1202 Fibonacci observed that this process terminates for any $x$ when $A=\\mathbb{N}$. -/\n@[category textbook, AMS 5]\ntheorem erdos_282.variants.fibonacci {x : ℚ} (hx : x ∈ Set.Ioo 0 1) :\n    greedyUnitFractionRem .univ x =ᶠ[atTop] 0 := by\n  sorry\n\n/--\nGraham has shown that $\\frac{m}{n}$ is the sum of distinct unit fractions\nwith denominators $\\equiv a\\pmod{d}$ if and only if\n$$\\left(\\frac{n}{(n,a,d)},\\frac{d}{(a,d)}\\right)=1.$$\nDoes the greedy algorithm always\nterminate in such cases?\n-/\n@[category research open, question, AMS 5]\ntheorem erdos_282.variants.graham :\n    ∀ x : ℚ, x ∈ Set.Ioo 0 1 → ∀ a d : ℕ, 1 < d →\n      (x.den / x.den.gcd (a.gcd d)).gcd (d / a.gcd d) = 1 →\n      greedyUnitFractionRem { n | n ≡ a [MOD d] } x =ᶠ[atTop] 0 := by\n  sorry\n\n@[category test, AMS 5]\ntheorem greedyUnitFractionRem_sq_one : greedyUnitFractionRem { n | IsSquare n } 1 0 = 0 := by\n  have : sInf {n : ℕ | IsSquare n ∧ 1 ≤ n} = 1 := IsLeast.csInf_eq <| by decide\n  aesop (add simp [greedyUnitFractionRem])\n\n/--\nGraham has also shown that $x$ is the sum of distinct unit fractions with\nsquare denominators if and only if $x\\in [0,\\pi^2/6-1)\\cup [1,\\pi^2/6)$. Does the\ngreedy algorithm for this always terminate? Erdős and Graham believe not - indeed, perhaps it\nfails to terminate almost always.\n-/\n@[category research open, question, AMS 5]\ntheorem erdos_282.variants.sq :\n    ∀ x : ℚ, (x : ℝ) ∈ Set.Ico 0 (π ^ 2 / 6 - 1) ∪ Set.Ico 1 (π ^ 2 / 6) →\n      greedyUnitFractionRem { n | IsSquare n } x =ᶠ[atTop] 0 := by\n  sorry\n\nend Erdos282\n",
  "statement_hash": "4533688d6305f09fc60e33202f610d5ccc38b1cfcab7e52619b4f3bd43cae18a",
  "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."
}