Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Erdős Problem 282 · greedyUnitFractionRem_sq_one

Source:Erdős Problems · erdosproblems.com/282
Sanity test Checks that the formal definitions behave as intended. First verified proof: +1 points.
Statement:reviewed
Statement:

No informal statement.

Subjects:Combinatorics (math.CO)
MSC classes:05
Cite as:NS.01539 [math.CO] · NS.01539v1 for this version
Declaration:Erdos282.greedyUnitFractionRem_sq_one
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 1; accepted critique: up to 100
Statement hash:4533688d6305f09fc60e33202f610d5ccc38b1cfcab7e52619b4f3bd43cae18a
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/ErdosProblems/282.lean

Formal statement

theorem greedyUnitFractionRem_sq_one : greedyUnitFractionRem { n | IsSquare n } 1 0 = 0
Show the full Challenge.lean (117 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Erdős Problem 282

*Reference:* [erdosproblems.com/282](https://www.erdosproblems.com/282)
-/

@[expose] public section

open Filter Real

namespace Erdos282

/-- Let $A\subseteq \mathbb{N}$ be an infinite set and consider the following
greedy algorithm for a rational $x$: choose the minimal $n\in A$ not used so far such
that $n\geq 1/x$ and repeat with $x$ replaced by $x-\frac{1}{n}$.

This process of subtracting unit fractions is modelled in `greedyUnitFractionRem`.
At each step `t : ℕ`, the function `greedyUnitFractionRem A x t` returns the remainder
of `x` with respect to the first `t + 1` unit fractions, with distinct denominators taken
from `A`. Once the remainder reaches `0` it stays `0`, and the process terminates. This
corresponds to producing a representation of `x` as the sum of distinct unit fractions with
denominators from `A`, however this function does not return this representation. -/
noncomputable def greedyUnitFractionRem (A : Set ℕ) (x : ℚ) (t : ℕ) : ℚ :=
  if x ≤ 0 then 0 else
    let n := sInf { n | n ∈ A ∧ 1 / x ≤ n }
    let rem := x - 1 / n
    match t with
    | 0 => rem
    | t + 1 => greedyUnitFractionRem (A \ {n}) rem t

@[category test, AMS 5]
theorem greedyUnitFractionRem_zero (n : ℕ) : greedyUnitFractionRem .univ (1 / n) 0 = 0 := by
  simp [greedyUnitFractionRem, Set.Ici_def]

@[category test, AMS 5]
theorem greedyUnitFractionRem_one (n : ℕ) : greedyUnitFractionRem .univ (1 / n) 1 = 0 := by
  simp [greedyUnitFractionRem, Set.Ici_def]

/-- Let $A\subseteq \mathbb{N}$ be an infinite set and consider the following
greedy algorithm for a rational $x\in (0,1)$: choose the minimal $n\in A$ not used
so far such that $n\geq 1/x$ and repeat with $x$ replaced by $x-\frac{1}{n}$. If this
terminates after finitely many steps then this produces a representation of
$x$ as the sum of distinct unit fractions with denominators from $A$.

Does this process always terminate if $x$ has odd denominator and $A$ is the
set of odd numbers? -/
@[category research open, AMS 5]
theorem erdos_282 {x : ℚ} (hx : x ∈ Set.Ioo 0 1) (hx_den : Odd x.den) :
    greedyUnitFractionRem { n | Odd n } x =ᶠ[atTop] 0 := by
  sorry

def erdos_282.variants.general.answer : Set (ℚ × Set ℕ) := sorry

/-- More generally, for which pairs $x$ and $A$ does this process terminate? -/
@[category research open, question value, AMS 5]
theorem erdos_282.variants.general (x : ℚ) (A : Set ℕ) :
      greedyUnitFractionRem A x =ᶠ[atTop] 0 ↔ (x, A) ∈ erdos_282.variants.general.answer := by
  sorry

/-- In 1202 Fibonacci observed that this process terminates for any $x$ when $A=\mathbb{N}$. -/
@[category textbook, AMS 5]
theorem erdos_282.variants.fibonacci {x : ℚ} (hx : x ∈ Set.Ioo 0 1) :
    greedyUnitFractionRem .univ x =ᶠ[atTop] 0 := by
  sorry

/--
Graham has shown that $\frac{m}{n}$ is the sum of distinct unit fractions
with denominators $\equiv a\pmod{d}$ if and only if
$$\left(\frac{n}{(n,a,d)},\frac{d}{(a,d)}\right)=1.$$
Does the greedy algorithm always
terminate in such cases?
-/
@[category research open, question, AMS 5]
theorem erdos_282.variants.graham :
    ∀ x : ℚ, x ∈ Set.Ioo 0 1 → ∀ a d : ℕ, 1 < d →
      (x.den / x.den.gcd (a.gcd d)).gcd (d / a.gcd d) = 1 →
      greedyUnitFractionRem { n | n ≡ a [MOD d] } x =ᶠ[atTop] 0 := by
  sorry

@[category test, AMS 5]
theorem greedyUnitFractionRem_sq_one : greedyUnitFractionRem { n | IsSquare n } 1 0 = 0 := by
  have : sInf {n : ℕ | IsSquare n ∧ 1 ≤ n} = 1 := IsLeast.csInf_eq <| by decide
  aesop (add simp [greedyUnitFractionRem])

/--
Graham has also shown that $x$ is the sum of distinct unit fractions with
square denominators if and only if $x\in [0,\pi^2/6-1)\cup [1,\pi^2/6)$. Does the
greedy algorithm for this always terminate? Erdős and Graham believe not - indeed, perhaps it
fails to terminate almost always.
-/
@[category research open, question, AMS 5]
theorem erdos_282.variants.sq :
    ∀ x : ℚ, (x : ℝ) ∈ Set.Ico 0 (π ^ 2 / 6 - 1) ∪ Set.Ico 1 (π ^ 2 / 6) →
      greedyUnitFractionRem { n | IsSquare n } x =ᶠ[atTop] 0 := by
  sorry

end Erdos282

To prove it: keep every definition of Challenge.lean unchanged and prove Erdos282.greedyUnitFractionRem_sq_one with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_greedyUnitFractionRem_sq_one : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry desk erdos-282--greedyunitfractionrem-sq-one      # a desk lease: required before submitting (renew: nosorry beat)
nosorry fetch erdos-282--greedyunitfractionrem-sq-one
nosorry submit erdos-282--greedyunitfractionrem-sq-one nosorry/erdos-282--greedyunitfractionrem-sq-one/Solution.lean --wait

Contributions

No contributions yet — be the first. Submit a proof or a finding.

Research in progress

People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.

Nobody has shared research on this problem yet.

Sign in to share your research.

Statement review

Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.

Sign in to open a critique.