{
  "id": "4467",
  "ident": "NS.04467",
  "slug": "oeis-102722",
  "title": "Floor of sum of $\\{n/k\\}$",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "A102722 Conjecture: $a(n) \\sim (1-\\gamma)n$.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA102722.conjecture",
  "statement_lean": "theorem conjecture :\n    (fun n : ℕ => (a n : ℝ)) ~[atTop]\n      (fun n : ℕ => (1 - Real.eulerMascheroniConstant) * (n : ℝ))",
  "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# Floor of sum of $\\{n/k\\}$\n\nGiven $n$, sum all division remainders $\\{n/k\\}$, with $k=1,\\dots,n$.\nThe value $a(n)$ is given by the floor of that sum. Note that $\\{x\\}:=x-[x]$.\nConjecture: a(n) ~ (1-EulerGamma)n.\n\n*References:*\n- [A102722](https://oeis.org/A102722)\n-/\n\n@[expose] public section\n\nnamespace OeisA102722\n\nopen BigOperators Finset Int Asymptotics Filter\n\n/-- The primary defining sequence `a`.\na n is the floor of the sum of all division remainders $\\{n/k\\}$, with $k=1,\\dots,n$.\n$$a(n) = \\left\\lfloor \\sum_{k=1}^n \\left\\{ \\frac{n}{k} \\right\\} \\right\\rfloor$$ -/\nnoncomputable def a (n : ℕ) : ℕ :=\n  let sumOfFractParts : ℝ :=\n    (Icc 1 n).sum fun k : ℕ =>\n      -- Int.fract is the fractional part function {x}.\n      fract ((n : ℝ) / (k : ℝ))\n  (floor sumOfFractParts).toNat\n\n@[category API, AMS 11]\nlemma a_sum_1 (f : ℕ → ℝ) : (Icc 1 1).sum f = f 1 := by\n  have h : Icc 1 1 = {1} := rfl\n  rw [h, Finset.sum_singleton]\n\n@[category API, AMS 11]\nlemma a_sum_2 (f : ℕ → ℝ) : (Icc 1 2).sum f = f 1 + f 2 := by\n  have h : Icc 1 2 = {1, 2} := rfl\n  rw [h, Finset.sum_insert (by decide), Finset.sum_singleton]\n\n@[category API, AMS 11]\nlemma a_sum_3 (f : ℕ → ℝ) : (Icc 1 3).sum f = f 1 + f 2 + f 3 := by\n  have h : Icc 1 3 = {1, 2, 3} := rfl\n  rw [h, Finset.sum_insert (by decide), Finset.sum_insert (by decide), Finset.sum_singleton,\n    add_assoc]\n\n@[category API, AMS 11]\nlemma a_sum_4 (f : ℕ → ℝ) : (Icc 1 4).sum f = f 1 + f 2 + f 3 + f 4 := by\n  have h : Icc 1 4 = {1, 2, 3, 4} := rfl\n  rw [h, Finset.sum_insert (by decide), Finset.sum_insert (by decide),\n    Finset.sum_insert (by decide), Finset.sum_singleton]\n  abel\n\n@[category API, AMS 11]\nlemma a_sum_5 (f : ℕ → ℝ) : (Icc 1 5).sum f = f 1 + f 2 + f 3 + f 4 + f 5 := by\n  have h : Icc 1 5 = {1, 2, 3, 4, 5} := rfl\n  rw [h, Finset.sum_insert (by decide), Finset.sum_insert (by decide),\n    Finset.sum_insert (by decide), Finset.sum_insert (by decide), Finset.sum_singleton]\n  abel\n\nmacro \"eval_a\" : tactic => `(tactic| (\n  delta a\n  simp only [a_sum_1, a_sum_2, a_sum_3, a_sum_4, a_sum_5]\n  norm_num\n))\n\n/-- Term theorems verifying the first few values of the sequence against the official OEIS b-file -/\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 0 := by eval_a\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 0 := by eval_a\n\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 0 := by eval_a\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 0 := by eval_a\n\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 1 := by eval_a\n\nset_option linter.style.formal_proof_palomar false in\n/-- A102722 Conjecture: $a(n) \\sim (1-\\gamma)n$. -/\n@[category research solved, AMS 11,\n  formal_proof using lean4 at\n    \"https://github.com/KitaKen1/oeis-102722-asymptotic/blob/0e3bf1bc6dfd04627f926b07fb8d25f4395a5072/lean/OEIS102722FC.lean#L18-L24\"]\ntheorem conjecture :\n    (fun n : ℕ => (a n : ℝ)) ~[atTop]\n      (fun n : ℕ => (1 - Real.eulerMascheroniConstant) * (n : ℝ)) := by\n  sorry\n\nend OeisA102722\n",
  "statement_hash": "97e8b87011e645708fe3d85b535fd30239185321150e99179de293a75bdab208",
  "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."
}