{
  "id": "6333",
  "ident": "NS.06333",
  "slug": "oeis-368626",
  "title": "A generating function with powers two and three",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "\"Conjecture: $a(n)$ is odd when $n = 2^k - 1$ for $k \\ge 0$ and even elsewhere.\"\n- Paul D. Hanna, Jan 09 2024.\n\nLean proof by Wentao Li, with AI assistance; see [Li26].",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA368626.conjecture",
  "statement_lean": "theorem conjecture (n : ℕ) : Odd (a n) ↔ ∃ k : ℕ, n = 2 ^ k - 1",
  "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# A generating function with powers two and three\n\nThe sequence consists of the coefficients of\n$A(x)=1+x(A(x)^2-A(-x)^2)/2+x(A(x)^3+A(-x)^3)/2$.\n\n*References:*\n- [A368626](https://oeis.org/A368626)\n- [Li26] Wentao Li, [Generating-function bridge and parity for A368626](https://github.com/VictorLiwentao/lean-oeis-proofs/blob/9d4a205da2a4094800f9c600a7b0b5223eda51ce/proofs/new-proofs/A368626/PROOF.md), 2026.\n-/\n\n@[expose] public section\n\nnamespace OeisA368626\n\n/-- Coefficients of the square of a power series with coefficient sequence $b$. -/\ndef conv2 (b : ℕ → ℕ) (n : ℕ) : ℕ :=\n  ∑ k ∈ Finset.range (n + 1), b k * b (n - k)\n\n/-- Coefficients of the cube of a power series with coefficient sequence $b$. -/\ndef conv3 (b : ℕ → ℕ) (n : ℕ) : ℕ :=\n  ∑ k ∈ Finset.range (n + 1), conv2 b k * b (n - k)\n\n/-- Coefficients of $A(x)=1+x(A(x)^2-A(-x)^2)/2+x(A(x)^3+A(-x)^3)/2$. -/\ndef a : ℕ → ℕ :=\n  Nat.strongRec fun n ih =>\n    if n = 0 then 1\n    else\n      let b : ℕ → ℕ := fun m => if h : m < n then ih m h else 0\n      if Even n then conv2 b (n - 1)\n      else conv3 b (n - 1)\n\n/-- The coefficient recurrence unfolded at an index. -/\n@[category API, AMS 11]\ntheorem a_eq (n : ℕ) :\n    a n = if n = 0 then 1 else\n      if Even n then conv2 (fun m => if m < n then a m else 0) (n - 1)\n      else conv3 (fun m => if m < n then a m else 0) (n - 1) := by\n  rw [a, Nat.strongRec_eq]\n  simp only [a, dite_eq_ite]\n\n@[category test, AMS 11]\ntheorem a_0 : a 0 = 1 := by\n  rw [a_eq]\n  norm_num\n\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 1 := by\n  rw [a_eq]\n  norm_num [conv3, conv2, Finset.sum_range_succ, a_0]\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 2 := by\n  rw [a_eq]\n  norm_num [conv3, conv2, Finset.sum_range_succ, a_0, a_1]\n\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 9 := by\n  rw [a_eq]\n  norm_num [conv3, conv2, Finset.sum_range_succ, a_0, a_1, a_2]\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 22 := by\n  rw [a_eq]\n  norm_num [conv3, conv2, Finset.sum_range_succ, a_0, a_1, a_2, a_3]\n\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 138 := by\n  rw [a_eq]\n  norm_num [conv3, conv2, Finset.sum_range_succ, a_0, a_1, a_2, a_3, a_4]\n\nset_option linter.style.formal_proof_palomar false in\n/--\n\"Conjecture: $a(n)$ is odd when $n = 2^k - 1$ for $k \\ge 0$ and even elsewhere.\"\n- Paul D. Hanna, Jan 09 2024.\n\nLean proof by Wentao Li, with AI assistance; see [Li26].\n-/\n@[category research solved, AMS 11,\n  formal_proof using lean4 at \"https://github.com/VictorLiwentao/lean-oeis-proofs/blob/9d4a205da2a4094800f9c600a7b0b5223eda51ce/LeanOeisProofs/NewProofs/A368626.lean#L529\"]\ntheorem conjecture (n : ℕ) : Odd (a n) ↔ ∃ k : ℕ, n = 2 ^ k - 1 := by\n  sorry\n\nend OeisA368626\n",
  "statement_hash": "f4af3a0b372924971d250b71f5619f3fa86cbebe8bc9ac945865b0e55718fe5b",
  "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."
}