{
  "id": "5448",
  "ident": "NS.05448",
  "slug": "oeis-227582",
  "title": "Representation of sequence terms by harmonic numbers $\\lfloor \\frac{1}{2H(n) - H(n^2+n-1) - \\gamma} \\rfloor$",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Conjecture (from A227581): $a(n) = \\lfloor 1/(2 H(n) - H(n^2 + n - 1) - \\gamma) \\rfloor$,\nwhere $H$ denotes harmonic numbers and $\\gamma$ denotes the Euler-Mascheroni constant.\n\nA formal proof has been found with the methods described in\n[arxiv/2605.22763](https://arxiv.org/abs/2605.22763).",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA227582.a_eq_floor_harmonic_expr",
  "statement_lean": "theorem a_eq_floor_harmonic_expr (n : ℕ) (hn : 0 < n) :\n    a n = (Int.floor (1 / (2 * (↑(harmonic n) : ℝ) -\n    (↑(harmonic (n * n + n - 1)) : ℝ) - Real.eulerMascheroniConstant))).toNat",
  "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# Representation of sequence terms by harmonic numbers $\\lfloor \\frac{1}{2H(n) - H(n^2+n-1) - \\gamma} \\rfloor$\n\nA227582: Expansion of $(2+3x+2x^2+2x^3+3x^4+x^5-x^6)/(1-2x+x^2-x^5+2x^6-x^7)$.\n\nThe sequence satisfies the linear recurrence:\n$$a(n) = 2 a(n-1) - a(n-2) + a(n-5) - 2 a(n-6) + a(n-7)$$\nwith initial values $a(1) = 2, a(2) = 7, a(3) = 14, a(4) = 23, a(5) = 35, a(6) = 50, a(7) = 67$.\n\nThe sequence is 1-indexed in OEIS, so $a(n)$ is the $(n-1)$-th term of the 0-indexed solution.\n\n*References:*\n- [A227582](https://oeis.org/A227582)\n- [arxiv/2605.22763](https://arxiv.org/abs/2605.22763) *Advancing Mathematics Research with AI-Driven Formal Proof Search* by George Tsoukalas et al.\n-/\n\n@[expose] public section\n\nnamespace OeisA227582\n\n\nopen BigOperators LinearRecurrence\n\n/--\nThe sequence $b_n$ such that $A227582(n) = b_{n-1}$ for $n \\ge 1$.\nThis is the 0-indexed solution to the linear recurrence in $\\mathbb{Z}$.\n-/\ndef baseSeq (n : ℕ) : ℤ :=\n  let order := 7\n  -- Coefficients $c_i$ for the recurrence $u_{n+7} = \\sum_{i=0}^6 c_i u_{n+i}$.\n  -- This corresponds to the OEIS signature $(2, -1, 0, 0, 1, -2, 1)$ which means $c_i = s_{7-i}$.\n  let coeffs : Fin order → ℤ := ![1, -2, 1, 0, 0, -1, 2]\n  -- Initial values $a_zero$ through $a_6$. These are {2, 7, 14, 23, 35, 50, 67}.\n  let init : Fin order → ℤ := ![2, 7, 14, 23, 35, 50, 67]\n  let E : LinearRecurrence ℤ := { order := order, coeffs := coeffs }\n  E.mkSol init n\n\n/--\nExpansion of $(2+3x+2x^2+2x^3+3x^4+x^5-x^6)/(1-2x+x^2-x^5+2x^6-x^7)$, 1-indexed.\n-/\ndef a (n : ℕ) : ℕ :=\n  if 0 < n then\n    (baseSeq (n - 1)).toNat\n  else\n    0\n\n\n@[category test, AMS 11]\nlemma a_1 : a 1 = 2 := by dsimp [a]; native_decide\n\n@[category test, AMS 11]\nlemma a_2 : a 2 = 7 := by dsimp [a]; native_decide\n\n@[category test, AMS 11]\nlemma a_3 : a 3 = 14 := by dsimp [a]; native_decide\n\n@[category test, AMS 11]\nlemma a_4 : a 4 = 23 := by dsimp [a]; native_decide\n\n@[category test, AMS 11]\nlemma a_5 : a 5 = 35 := by dsimp [a]; native_decide\n\n/--\nThe linear recurrence:\n$$b(n + 7) = 2 b(n + 6) - b(n + 5) + b(n + 2) - 2 b(n + 1) + b(n)$$\nholds for `baseSeq`. This follows directly from `LinearRecurrence.is_sol_mkSol`.\n-/\n@[category API, AMS 11]\ntheorem baseSeq_recurrence (n : ℕ) :\n    baseSeq (n + 7) = 2 * baseSeq (n + 6) - baseSeq (n + 5) +\n    baseSeq (n + 2) - 2 * baseSeq (n + 1) + baseSeq n := by\n  let E : LinearRecurrence ℤ := ⟨7, ![1, -2, 1, 0, 0, -1, 2]⟩\n  let init : Fin 7 → ℤ := ![2, 7, 14, 23, 35, 50, 67]\n  -- baseSeq is definitionally E.mkSol init\n  change E.mkSol init (n + 7) =\n    2 * E.mkSol init (n + 6) - E.mkSol init (n + 5) +\n    E.mkSol init (n + 2) - 2 * E.mkSol init (n + 1) + E.mkSol init n\n  have h := E.is_sol_mkSol init n\n  -- h : mkSol(n+7) = ∑ i : Fin 7, coeffs[i] * mkSol(n+i)\n  rw [h]\n  -- Expand the sum and reduce all coefficient lookups\n  simp only [Fin.sum_univ_seven, E, Fin.isValue]\n  -- Reduce matrix lookups: ![1, -2, 1, 0, 0, -1, 2] i for all i : Fin 7\n  -- and Fin coercions: ↑(i : Fin 7) for each i\n  norm_num [show (![1, -2, 1, 0, 0, -1, 2] : Fin 7 → ℤ) 0 = 1 from rfl,\n    show (![1, -2, 1, 0, 0, -1, 2] : Fin 7 → ℤ) 1 = -2 from rfl,\n    show (![1, -2, 1, 0, 0, -1, 2] : Fin 7 → ℤ) 2 = 1 from rfl,\n    show (![1, -2, 1, 0, 0, -1, 2] : Fin 7 → ℤ) 3 = 0 from rfl,\n    show (![1, -2, 1, 0, 0, -1, 2] : Fin 7 → ℤ) 4 = 0 from rfl,\n    show (![1, -2, 1, 0, 0, -1, 2] : Fin 7 → ℤ) 5 = -1 from rfl,\n    show (![1, -2, 1, 0, 0, -1, 2] : Fin 7 → ℤ) 6 = 2 from rfl]\n  ring\n\nset_option linter.style.formal_proof_palomar false in\n/--\nConjecture (from A227581): $a(n) = \\lfloor 1/(2 H(n) - H(n^2 + n - 1) - \\gamma) \\rfloor$,\nwhere $H$ denotes harmonic numbers and $\\gamma$ denotes the Euler-Mascheroni constant.\n\nA formal proof has been found with the methods described in\n[arxiv/2605.22763](https://arxiv.org/abs/2605.22763).\n-/\n@[category research solved, AMS 11, formal_proof using formal_conjectures at\n\"https://github.com/mo271/formal-conjectures/blob/a32396489dcb8f86c3549b93aa358ac6a10a3a1f/FormalConjectures/OEIS/227582.wip.lean#L282\"]\ntheorem a_eq_floor_harmonic_expr (n : ℕ) (hn : 0 < n) :\n    a n = (Int.floor (1 / (2 * (↑(harmonic n) : ℝ) -\n    (↑(harmonic (n * n + n - 1)) : ℝ) - Real.eulerMascheroniConstant))).toNat := by\n    sorry\n\nend OeisA227582\n",
  "statement_hash": "6655b0509b4c993cfee4cefd27850d156f170b600ec6037df84f8bce75b9d512",
  "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."
}