{
  "id": "2007",
  "ident": "NS.02007",
  "slug": "erdos-400",
  "title": "Erdős Problem 400",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Can one show that $\\sum_{n\\leq x}g_k(n) \\sim c_k x\\log x$ for some constant $c_k$?",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": "https://www.erdosproblems.com/400",
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos400.erdos_400.parts.i",
  "statement_lean": "theorem erdos_400.parts.i :\n    ∀ᵉ (k ≥ 2), ∃ c : ℝ,\n      (fun x : ℕ ↦ (∑ n ∈ Icc 1 x, (g k n : ℝ))) ~[atTop]\n      (fun x : ℕ ↦ c * x * Real.log x)",
  "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 400\n\n*Reference:* [erdosproblems.com/400](https://www.erdosproblems.com/400)\n-/\n\n@[expose] public section\n\nopen Nat Filter Finset\nopen scoped Asymptotics Topology\n\nnamespace Erdos400\n\n/--\nFor any $k\\geq 2$ let $g_k(n)$ denote the maximum value of $(a_1+\\cdots+a_k)-n$\nwhere $a_1,\\ldots,a_k$ are integers such that $a_1!\\cdots a_k! \\mid n!$.\n-/\nnoncomputable def g (k n : ℕ) : ℕ :=\n  sSup { ((∑ i, a i) - n) | (a : Fin k → ℕ) (_ : (∏ i, (a i) !) ∣ n !) }\n\n/--\nCan one show that $\\sum_{n\\leq x}g_k(n) \\sim c_k x\\log x$ for some constant $c_k$?\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_400.parts.i :\n    ∀ᵉ (k ≥ 2), ∃ c : ℝ,\n      (fun x : ℕ ↦ (∑ n ∈ Icc 1 x, (g k n : ℝ))) ~[atTop]\n      (fun x : ℕ ↦ c * x * Real.log x) := by\n  sorry\n\n/--\nIs it true that there is a constant $c_k$ such that for almost all $n < x$ we have\n$g_k(n)=c_k\\log x+o(\\log x)$?\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_400.parts.ii :\n    ∀ᵉ (k ≥ 2), ∃ c : ℝ, ∀ ε > 0,\n      Tendsto (fun x : ℕ ↦\n        (((Icc 1 x).filter (fun n ↦\n          |(g k n : ℝ) - c * Real.log x| ≤ ε * Real.log x)).card : ℝ) / x)\n        atTop (𝓝 1) := by\n  sorry\n\n/--\nErdős and Graham write that it is easy to show that $g_k(n) \\ll_k \\log n$ always, but the best\npossible constant is unknown.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_400.variants.upper_bound (k : ℕ) (hk : k ≥ 2) :\n    (fun n : ℕ ↦ (g k n : ℝ)) ≪ (fun n : ℕ ↦ Real.log (n : ℝ)) := by\n  sorry\n\n\n/-- For $k \\ge 2$, $g_k(n) > 0$. We show this by choosing $a = (n, 1, 0, \\ldots, 0)$. -/\n@[category test, AMS 11]\ntheorem erdos_400.variants.g_pos (k n : ℕ) (h: k ≥ 2) : 0 < g k n := by\n  obtain ⟨k', rfl⟩ : ∃ k', k = k' + 2 := ⟨k - 2, by omega⟩\n  simp only [g]\n  -- Witness: a(0) = n, a(1) = 1, a(i) = 0 for i ≥ 2\n  set a : Fin (k' + 2) → ℕ := fun i =>\n    if (i : ℕ) = 0 then n else if (i : ℕ) = 1 then 1 else 0 with ha_def\n  have h_prod : ∏ i : Fin (k' + 2), (a i)! = n ! := by\n    rw [Fin.prod_univ_succ]; simp [ha_def]\n    rw [Fin.prod_univ_succ]; simp\n  have h_sum : ∑ i : Fin (k' + 2), a i = n + 1 := by\n    rw [Fin.sum_univ_succ]; simp [ha_def]\n  -- 1 is in the set\n  have hmem : 1 ∈ {(∑ i, b i) - n | (b : Fin (k' + 2) → ℕ) (_ : ∏ i, (b i)! ∣ n !)} :=\n    ⟨a, h_prod ▸ dvd_refl n !, by omega⟩\n  -- The set is bounded above by (k'+2) * n!\n  have hbdd : BddAbove {(∑ i, b i) - n | (b : Fin (k' + 2) → ℕ) (_ : ∏ i, (b i)! ∣ n !)} := by\n    refine ⟨(k' + 2) * n !, ?_⟩\n    rintro x ⟨b, hb, rfl⟩\n    calc (∑ i, b i) - n\n        ≤ ∑ i, b i := Nat.sub_le _ _\n      _ ≤ ∑ i : Fin (k' + 2), (b i)! :=\n          Finset.sum_le_sum fun i _ => Nat.self_le_factorial _\n      _ ≤ Finset.univ.card • n ! := by\n          apply Finset.sum_le_card_nsmul; intro i _\n          exact le_trans (Finset.single_le_prod' (fun j _ =>\n            Nat.one_le_iff_ne_zero.mpr (Nat.factorial_ne_zero _))\n            (Finset.mem_univ i)) (Nat.le_of_dvd (Nat.factorial_pos n) hb)\n      _ = (k' + 2) * n ! := by simp [smul_eq_mul]\n  exact Nat.lt_of_lt_of_le Nat.one_pos (le_csSup hbdd hmem)\n\nend Erdos400\n",
  "statement_hash": "a30d632b4873851ec45064612dc3e038b81a5dc3f0fbb65b05d2e939b1bab5c9",
  "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."
}