Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

First phase of the Erdős 261 greedy carry in closed form

Proved
Erdos261.greedy_first_phase

by Ethan Cheung Wang · Oct 23, 2026 · Mathlib 0df444a (Lean v4.33.1)

erdos-problemsnumber-theory

Let gjg_jgj​ be the greedy carry for Erdős Problem 261 started at (n,n)(n,n)(n,n): g0=ng_0=ng0​=n, and gj+1=2gj−(n+j+1)g_{j+1}=2g_j-(n+j+1)gj+1​=2gj​−(n+j+1) if 2gj≥n+j+12g_j\ge n+j+12gj​≥n+j+1 (a subtracting step, the term (n+j+1)/2n+j+1(n+j+1)/2^{n+j+1}(n+j+1)/2n+j+1 is used), otherwise gj+1=2gjg_{j+1}=2g_jgj+1​=2gj​ (a doubling step). Then gj/2n+jg_j/2^{n+j}gj​/2n+j is what remains of n/2nn/2^nn/2n after the terms used so far, and the greedy algorithm terminates iff some gj=0g_j=0gj​=0. Write cj=2j+1−j−2c_j=2^{j+1}-j-2cj​=2j+1−j−2 (so c0=0c_0=0c0​=0, cj+1=2cj+j+1c_{j+1}=2c_j+j+1cj+1​=2cj​+j+1; these are the Borwein–Loring numbers). Theorem. If cj≤nc_j\le ncj​≤n, then for every i≤ji\le ji≤j,

gi=n−ci,and step i is subtracting  ⟺  n≥ci+1.g_i=n-c_i,\qquad\text{and step } i \text{ is subtracting}\iff n\ge c_{i+1}.gi​=n−ci​,and step i is subtracting⟺n≥ci+1​.

Hence the greedy orbit starts with a run of exactly jjj subtracting steps, where cj≤n<cj+1c_j\le n<c_{j+1}cj​≤n<cj+1​, and it terminates during this run iff n=cjn=c_jn=cj​, i.e. exactly for the Borwein–Loring numbers n=2j+1−j−2n=2^{j+1}-j-2n=2j+1−j−2.

Formalization Note. cic_ici​ is written with truncated subtraction 2 ^ (i + 1) - i - 2, which is exact since i+2≤2i+1i+2\le 2^{i+1}i+2≤2i+1.

Preamble
import Mathlib
import Definitions.Def_Erdos261_defs
open Finset
Formal statement
namespace Erdos261

theorem greedy_first_phase (n j : ℕ) (h : 2 ^ (j + 1) - j - 2 ≤ n) :
    ∀ i ≤ j, greedy n i = (n : ℤ) - ((2 ^ (i + 1) - i - 2 : ℕ) : ℤ) ∧
      (((n + i + 1 : ℕ) : ℤ) ≤ 2 * greedy n i ↔ 2 ^ (i + 1 + 1) - (i + 1) - 2 ≤ n) := by sorry

end Erdos261
Source
Erdős Problem 261 (https://www.erdosproblems.com/261); greedy carry as in Borwein–Loring 1990 / Tengely–Ulas–Zygadło 2020 (platform def Def_Erdos261_defs); Claim A1c of claim from GPT 6.1 Sol (second answer, Oct 23 2026), Lean-verified by Grok Bot for Ethan Cheung (Oct 23 2026)

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me