Erdős Problem 357: bounds on sequences with distinct consecutive sums, formalized in Lean

An upper bound with leading constant below 1/2 and a lower bound of order √n, with written proofs and a Lean formalization

For Erdős Problem 357, the largest k with 1 ≤ a₁ < … < aₖ ≤ n and all consecutive sums distinct satisfies f(n) ≤ (44273/90000)n + 2√n + 177792 and, for large n, f(n) ≥ (15/√21)√n − 1800. The proofs and the Lean formalization were produced by AI agents, and the Lean statements are pinned to the community’s formal definition. Whether f(n) = o(n) is still open.

Let f(n)f(n) be the largest kk for which there are integers 1≤a1<a2<⋯<ak≤n1 \le a_1 < a_2 < \dots < a_k \le n whose consecutive sums ai+ai+1+⋯+aja_i + a_{i+1} + \dots + a_j are all different. Erdős and Harzheim asked how f(n)f(n) grows, and in particular whether f(n)=o(n)f(n) = o(n): whether such sequences must thin out to a vanishing fraction of [1,n][1, n]. The question is Erdős Problem 357, and it is open.

Before this work, the best bounds we found were of the form f(n)≤n/2+O(n)f(n) \le n/2 + O(\sqrt n) (informal, July 2026) and f(n)≥(4/3−o(1))nf(n) \ge (4/\sqrt3 - o(1))\sqrt n (a web manuscript). The upper bound n/2n/2 comes from a tidy “crossing” argument, and getting below it needs something more.

Results

StatementStatus
Upper bound above (Theorem 1.1 of the paper)Lean proof; complete written proof
f(21m2+105m+46)≥12mf(21m^2+105m+46) \ge 12m, hence f(n)≥1221n−48f(n) \ge \frac{12}{\sqrt{21}}\sqrt n - 48 (Theorem 1.2)Lean proof; complete written proof
f(12096j2+87024j+81)≥360jf(12096j^2+87024j+81) \ge 360j for j≥500j \ge 500, hence the 15/2115/\sqrt{21} bound (Theorem 1.3)Lean proof; complete written proof
f(n)≤7971620n+2n+7f(n) \le \frac{797}{1620}n + 2\sqrt n + 7, a simpler variant that is the smaller bound for n<3,348,973,256n < 3{,}348{,}973{,}256Lean proof; outline only in the paper
Exact f(n)f(n) for every n≤77n \le 77Computer search: evidence, not proof

The upper bound is below n/2n/2 only once n≥23,202,647n \ge 23{,}202{,}647, because of its additive constant. What it changes is the leading constant: lim sup⁡f(n)/n≤44273/90000\limsup f(n)/n \le 44273/90000. The constants above are exact. Their decimals are truncated, never rounded up or down to look better.

How the bounds work

Upper bound. Every term whose prefix sum passes n/2n/2 owns a block sum in (n/2,n](n/2, n], and these are all different, which gives roughly n/2n/2. The new step is a lemma: a short block can be extended one term to the left without its sum exceeding nn, as long as the sum is at most (2n+4)/3(2n+4)/3. So every integer of (n/2,2n/3](n/2, 2n/3] that is missing from the sequence costs it one term. Missing integers are then forced by a small identity: the ℓ+1\ell+1 consecutive integers starting at ℓw\ell w have the same sum as the ℓ\ell consecutive integers starting at (ℓ+1)w+1(\ell+1)w+1. A valid sequence cannot contain both runs, so at least one of the integers is missing. Five families of such run pairs, arranged so that no integer belongs to more than two of them, force at least 29082908 missing integers per 360000360000.

Lower bounds. These build explicit sequences. Six residues modulo 42, 2,7,11,25,26,342, 7, 11, 25, 26, 34, repeated with period 42 and shifted by a large offset, have block sums whose residues determine the block’s length modulo 12. A size argument separates lengths that differ by 12 or more. That gives 12/2112/\sqrt{21}. Adding 84 to the last fifth of the terms keeps every residue and reduces every possible coincidence to one divisor equation. A counting argument shows that some offset in a window avoids it, which gives 15/2115/\sqrt{21}. The framework of residue patterns plus a size argument is Pickhardt’s; the pattern, the skip and the proofs are new as far as we found.

How it was checked

The six Lean 4 files prove the theorems for a function f that Lean confirms, by definitional equality, is the f of the Formal Conjectures project’s statement of the problem. They do not prove a weaker variant with a similar name. The checks:

  • a clean build with Lean v4.27.0 and Mathlib v4.27.0;
  • all 1023 declarations depend only on Lean’s three standard axioms, with no sorry, no native_decide and no added axiom;
  • every module replays through lean4checker;
  • a script checks every number and finite case in the written proofs with exact arithmetic;
  • two AI reviews, one of them adversarial with its own recomputation, found no mathematical error, and every presentation problem they raised was fixed;
  • the exact values for n≤77n \le 77 were reproduced by a third exhaustive search, written without access to the first two.

What “reproduced” means here. These checks were run by AI sessions on the lab’s machine, repeatedly and from clean builds. By this archive’s rules, a result checked only by AI sessions is not marked verified until the author has run the checks personally; that takes one command (below). The entry will be revised when that happens. No human mathematician has checked the proofs, and the paper has not been peer reviewed.

Repeat the checks (needs elan, Git, Python 3, ~8 GB)
git clone https://github.com/dreadpiratechan/erdos-357
cd erdos-357
FETCH_CACHE=1 bash verification/run_all.sh

The repository’s README explains how to add the kernel replay with lean4checker. On Windows, it says to clone to a short path.

How the results were found

By AI agents, working in a research repository the author set up and directed:

  • An OpenAI Codex agent found a modulus-22 predecessor pattern and its Lean proof on 9 September 2026.
  • A multi-agent run of Claude models on the night of 22–23 October produced the modulus-42 pattern, the skip, the first upper bounds below 1/21/2, and their Lean proofs.
  • A further Claude agent produced the five-band design of the final upper bound later on 23 October.
  • Claude (Opus 5.5) then wrote the paper and ran the audits.

The author chose the problem, commissioned the runs and decided what to publish. The records show no human contribution to the mathematics itself. The paper’s statement on AI use and the repository’s docs/PROVENANCE.md give the details. The author takes responsibility for the claims on this page and for correcting any that are found to be wrong.

Limits

  • Whether f(n)=o(n)f(n) = o(n) is untouched.
  • Novelty is not established. No source we found states any of these constants, but two relevant papers were readable only as abstracts or reviews: Hegyvári (1986) and Coppersmith and Phillips (1996). The search is described in the repository’s docs/LITERATURE.md.
  • The gain in the upper bound is small, 727/90000≈0.008727/90000 \approx 0.008 in the leading constant, and the method appears to be near its limit.
  • The lower bounds are of order n\sqrt n, while computer constructions suggest f(n)f(n) is much larger: a valid sequence of 26813 terms exists in [1,2⋅107][1, 2\cdot10^7].

↑ ↓ move, Enter open Search with filters