{
  "id": "3750",
  "ident": "NS.03750",
  "slug": "erdos-954",
  "title": "Erdős Problem 954",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Let $0=a_0<a_1<a_2<\\cdots$ be the sequence of integers defined by $a_0=0$ and $a_1=1$, and\n$a_{k+1}$ is the smallest integer $n$ for which the number of solutions to $a_i+a_j \\leq n$\n(with $0\\leq i\\leq j\\leq k$ and $j\\geq 1$) is $<n$.\n\nIs the number of solutions to $a_i+a_j \\leq x$ equal to $x+O(x^{1/4+o(1)})$?\n\nThe sequence was constructed by Rosen [Er77c, p. 71]. We read $O(x^{1/4+o(1)})$ as\n$O(x^{1/4+\\varepsilon})$ for every $\\varepsilon>0$, and use the version with $a_0=0$.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos954.erdos_954",
  "statement_lean": "theorem erdos_954 :\n    ∀ ε > (0 : ℝ), (fun x : ℕ ↦ (solutionCount x : ℝ) - x) =O[atTop]\n      (fun x : ℕ ↦ (x : ℝ) ^ ((1 : ℝ) / 4 + ε))",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Erdős Problem 954\n\n*References:*\n- [erdosproblems.com/954](https://www.erdosproblems.com/954)\n- [Er77c] Erdős, P., *Problems and results on combinatorial number theory. III*. Number theory\n  day (Proc. Conf., Rockefeller Univ., New York, 1976), Lecture Notes in Math. 626, Springer\n  (1977), 43-72. [PDF](https://www.renyi.hu/~p_erdos/1977-27.pdf)\n-/\n\n@[expose] public section\n\nopen Filter Asymptotics\n\nnamespace Erdos954\n\n/-- `pairCount a m n` is the number of pairs `(i, j)` with `0 ≤ i ≤ j ≤ m`, `1 ≤ j` and\n`a i + a j ≤ n`. -/\ndef pairCount (a : ℕ → ℕ) (m n : ℕ) : ℕ :=\n  ((Finset.range (m + 1) ×ˢ Finset.range (m + 1)).filter\n    fun p : ℕ × ℕ => p.1 ≤ p.2 ∧ 1 ≤ p.2 ∧ a p.1 + a p.2 ≤ n).card\n\n/-- Stage `k` of the construction of Rosen's sequence: `rosenAux k i = a_i` for `i ≤ k + 1`.\n\nStage `0` holds `a_0 = 0` and `a_1 = 1` (the value `1` at the unused indices `i ≥ 2` is a\nplaceholder). Stage `k + 1` appends `a_{k+2}`, the least `n` such that the number of pairs\n`(i, j)` with `0 ≤ i ≤ j ≤ k + 1`, `1 ≤ j` and `a_i + a_j ≤ n` is less than `n`. This count is\nbelow `(k + 2) ^ 2`, so the set is nonempty and `sInf` is a genuine minimum. -/\nnoncomputable def rosenAux : ℕ → ℕ → ℕ\n  | 0 => fun i => if i = 0 then 0 else 1\n  | k + 1 => fun i =>\n      if i = k + 2 then sInf {n : ℕ | pairCount (rosenAux k) (k + 1) n < n} else rosenAux k i\n\n/-- Rosen's sequence $a_0=0$, $a_1=1$, $a_{k+1}=\\min\\{n : \\#\\{(i,j) : 0\\le i\\le j\\le k,\\ j\\ge 1,\na_i+a_j\\le n\\} < n\\}$. It begins $0,1,3,5,9,13,17,24,31,38,45,\\ldots$ -/\nnoncomputable def rosen (k : ℕ) : ℕ := rosenAux k k\n\n/-- The number of solutions of $a_i+a_j\\le x$ with $0\\le i\\le j$ and $j\\ge 1$, over the whole\nsequence `rosen`. The sequence is strictly increasing with `rosen 0 = 0`, so `rosen j ≥ j`.\nHence a pair with `rosen i + rosen j ≤ x` has `j ≤ x`, and counting the pairs with `j ≤ x`\ncounts all solutions. -/\nnoncomputable def solutionCount (x : ℕ) : ℕ := pairCount rosen x x\n\n@[category test, AMS 11]\ntheorem rosen_zero : rosen 0 = 0 := by\n  decide\n\n@[category test, AMS 11]\ntheorem rosen_one : rosen 1 = 1 := by\n  decide\n\n@[category test, AMS 11]\ntheorem rosen_two : rosen 2 = 3 := by\n  show sInf {n : ℕ | pairCount (rosenAux 0) 1 n < n} = 3\n  exact IsLeast.csInf_eq (by decide)\n\n/--\nLet $0=a_0<a_1<a_2<\\cdots$ be the sequence of integers defined by $a_0=0$ and $a_1=1$, and\n$a_{k+1}$ is the smallest integer $n$ for which the number of solutions to $a_i+a_j \\leq n$\n(with $0\\leq i\\leq j\\leq k$ and $j\\geq 1$) is $<n$.\n\nIs the number of solutions to $a_i+a_j \\leq x$ equal to $x+O(x^{1/4+o(1)})$?\n\nThe sequence was constructed by Rosen [Er77c, p. 71]. We read $O(x^{1/4+o(1)})$ as\n$O(x^{1/4+\\varepsilon})$ for every $\\varepsilon>0$, and use the version with $a_0=0$.\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_954 :\n    ∀ ε > (0 : ℝ), (fun x : ℕ ↦ (solutionCount x : ℝ) - x) =O[atTop]\n      (fun x : ℕ ↦ (x : ℝ) ^ ((1 : ℝ) / 4 + ε)) := by\n  sorry\n\n/--\nErdős and Rosen could not even prove that the number of solutions to $a_i+a_j\\leq x$ is at most\n$(1+o(1))x$ [Er77c, p. 71].\n-/\n@[category research open, AMS 11]\ntheorem erdos_954.variants.upper :\n    ∀ ε > (0 : ℝ), ∀ᶠ x : ℕ in atTop, (solutionCount x : ℝ) ≤ (1 + ε) * x := by\n  sorry\n\n/--\nThe number of solutions to $a_i+a_j\\leq x$ is always at least $x$ by construction\n[Er77c, p. 71].\n-/\n@[category textbook, AMS 11]\ntheorem erdos_954.variants.lower : ∀ x : ℕ, x ≤ solutionCount x := by\n  sorry\n\nend Erdos954\n",
  "statement_hash": "255cdc3284e025c39db7e6772676207fdfba3cbe5ad3167c0deb4ad25c1c9462",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}