Hofstadter's set (Erdős problem 424) has natural density 2/3
Dominik Opwis
Abstract
Let A be the smallest set of natural numbers that contains 2 and 3 and contains ab − 1 for all distinct a, b in A (Erdős problem 424, attributed to Hofstadter; OEIS A005244). Korsky (2026) proved that A has positive lower density. This work proves that A has a natural density and that the density equals 2/3: the proportion of elements of A below n tends to 2/3. Since no element of A is congruent to 1 modulo 3, almost every natural number that is not congruent to 1 modulo 3 belongs to A.
Main result
The formal statement, as the editor compares it with the paper (file Challenge.lean, comments removed):
inductive Generated : ℕ → Prop
| two : Generated 2
| three : Generated 3
| step {a b : ℕ} : Generated a → Generated b → a ≠ b → Generated (a * b - 1)
theorem density_eq_two_thirds :
Filter.Tendsto (fun n : ℕ => (Set.ncard {m : ℕ | m < n ∧ Generated m} : ℝ) / n)
Filter.atTop (nhds (2 / 3))
Correspondence: Theorem 1 → Hofstadter.density_eq_two_thirds. Natural numbers start at 0 in Lean; members of A are at least 2, so a * b - 1 is ordinary subtraction.
Problem history
- Posed by Erdős, who attributed it to Hofstadter, in Problems and results on combinatorial number theory, III, Lecture Notes in Mathematics 626 (1977), 43–72.
- Listed as Erdős problem 424 and as Problem 63 in Ben Green's list of 100 open problems; the set is OEIS A005244.
- Upper bound 2/3: no element is 1 modulo 3 (Steinerberger, recorded on the Erdős problems page).
- Positive lower density: Korsky, arXiv:2608.07910 (2026). The present proof reuses his interval-coding idea; the project records that Korsky confirmed the credit by email.
Outline of the proof
Call n missing if n is not 1 modulo 3 and n ∉ A. The proof shows that the missing numbers have density zero.
- An interval coding of compositions of the maps x ↦ ax − 1 gives a positive proportion of affine maps of one slope that preserve A.
- An additive large sieve shows that A contains a positive proportion of the integers without small prime factors, at every scale.
- Since s, y ∈ A implies sy − 1 ∈ A, a variance argument shows that "n − 1 is missing" agrees with "n/s is missing" for almost all n and s.
- Using 2, 3, 9 ∈ A, being missing is almost invariant under n ↦ n + 1 and n ↦ sn, hence locally constant on intervals of any power-of-log length.
- Dirichlet polynomials and a packing argument make it constant on long multiplicative ranges; positive density of A forces the constant to be "not missing".
- A final variance argument passes to natural density.
Verification record
Builds at pinned versionsLean 4.35.0, Mathlib v4.35.0 (commit 56a0058), 133 Lean files, 26,343 lines
No sorry outside the statement fileThe only sorry is the placeholder in Challenge.lean
No new axioms or trusted codeNo axiom, admit, implemented_by or extern; no native_decide
Standard axioms onlypropext, Classical.choice, Quot.sound
Theorem proved is the theorem statedThe main theorem and the definition Generated elaborate identically in Challenge.lean and Solution.lean
Note for referees. Five steps use decide +kernel, a finite computation checked by the kernel itself (Input/Cert.lean and RoughElements/L8.lean). These are fully verified; they are listed because the referee may want to know which parts of the proof are computation.
AI-use statement
As declared in the project's metadata: AI agents (Claude models, run in Claude Code) found the argument, wrote and refereed a proof outline, stated all lemmas in Lean and proved them, and wrote the paper. The maintainer chose the problem, directed the work, set the order of models and the checks, and is responsible for the submission. The project states that no human mathematician has reviewed the argument or the Lean code, and that the search for earlier proofs used keyword searches and was not exhaustive.
In a real submission this statement would go to the referees, who would be asked in particular to confirm novelty and to read the paper's argument for exposition.
Archive and citation
In a published article this section gives the article DOI, the DOI of the archived formal project, and a suggested citation. For this demonstration, cite the original project:
D. Opwis, Hofstadter's set (Erdős problem 424) has natural density 2/3,
Lean 4 project, commit 880d923, https://github.com/Dominik-O22/erdos424-density (2026).
Palomar registry entry PALOMAR-2026-12-05-000051.