Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Runs of the Erdős 261 greedy carry have logarithmic length

Proved
Erdos261.run_length_bound

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), otherwise gj+1=2gjg_{j+1}=2g_jgj+1​=2gj​ (a doubling step). Equivalently (N,R)↦(N+1, 2R mod (N+1))(N,R)\mapsto(N+1,\,2R\bmod(N+1))(N,R)↦(N+1,2Rmod(N+1)) with Nj=n+jN_j=n+jNj​=n+j, Rj=gjR_j=g_jRj​=gj​; the greedy algorithm terminates iff some gj=0g_j=0gj​=0. Theorem. Let N=n+j≥2N=n+j\ge2N=n+j≥2 and h=⌈log⁡2N⌉h=\lceil\log_2 N\rceilh=⌈log2​N⌉. Then the h+2h+2h+2 steps j,…,j+h+1j,\dots,j+h+1j,…,j+h+1 are not all subtracting, and, if gj≥1g_j\ge1gj​≥1, they are not all doubling. Hence every maximal run of equal decisions starting at NNN has length at most ⌈log⁡2N⌉+1\lceil\log_2 N\rceil+1⌈log2​N⌉+1.

A doubling run gives gj+L=2Lgj≥4N>N+Lg_{j+L}=2^Lg_j\ge4N>N+Lgj+L​=2Lgj​≥4N>N+L, and a subtracting run gives Dj+L=2LDj≥8N>N+L+2D_{j+L}=2^LD_j\ge8N>N+L+2Dj+L​=2LDj​≥8N>N+L+2, contradicting 0≤g≤N0\le g\le N0≤g≤N. (Close to Borwein–Loring 1990, Prop. 2 / Cor. 2 on strings of 0s and 1s.)

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

theorem run_length_bound (n j : ℕ) (hN : 2 ≤ n + j) :
    (1 ≤ greedy n j →
      ¬ ∀ i < Nat.clog 2 (n + j) + 2, 2 * greedy n (j + i) < ((n + (j + i) + 1 : ℕ) : ℤ)) ∧
    (¬ ∀ i < Nat.clog 2 (n + j) + 2, ((n + (j + i) + 1 : ℕ) : ℤ) ≤ 2 * greedy n (j + i)) := 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 A1 of claim from a GPT answer relayed by Ethan Cheung (third round, 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