{
  "id": "6341",
  "ident": "NS.06341",
  "slug": "oeis-368628",
  "title": "A generating function with powers two and four",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "\"Conjecture: $a(n)$ is odd when $n = (4^k - 1)/3$ for $k \\ge 0$, and even elsewhere.\"\n- Paul D. Hanna, Jan 10 2024.\n\nLean formalization 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": "OeisA368628.conjecture",
  "statement_lean": "theorem conjecture (n : ℕ) : Odd (a n) ↔ ∃ k : ℕ, n = (4 ^ k - 1) / 3",
  "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 four\n\nThe sequence consists of the coefficients of\n$A(x)=1+x(A(x)^2-A(-x)^2)/2+x(A(x)^4+A(-x)^4)/2$.\n\n*References:*\n- [A368628](https://oeis.org/A368628)\n- [Li26] Wentao Li, [Generating-function bridge and parity for A368628](https://github.com/VictorLiwentao/lean-oeis-proofs/blob/b5eabe63ce276d12170d18f91b5b7327130c4cbe/proofs/new-formalization/A368628/PROOF.md), 2026.\n-/\n\n@[expose] public section\n\nnamespace OeisA368628\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 fourth power of a power series with coefficient sequence $b$. -/\ndef conv4 (b : ℕ → ℕ) (n : ℕ) : ℕ :=\n  conv2 (conv2 b) n\n\n/-- Coefficients of $A(x)=1+x(A(x)^2-A(-x)^2)/2+x(A(x)^4+A(-x)^4)/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) else conv4 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 conv4 (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 [conv4, 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 [conv4, conv2, Finset.sum_range_succ, a_0, a_1]\n\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 14 := by\n  rw [a_eq]\n  norm_num [conv4, conv2, Finset.sum_range_succ, a_0, a_1, a_2]\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 32 := by\n  rw [a_eq]\n  norm_num [conv4, conv2, Finset.sum_range_succ, a_0, a_1, a_2, a_3]\n\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 345 := by\n  rw [a_eq]\n  norm_num [conv4, 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 = (4^k - 1)/3$ for $k \\ge 0$, and even elsewhere.\"\n- Paul D. Hanna, Jan 10 2024.\n\nLean formalization 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/b5eabe63ce276d12170d18f91b5b7327130c4cbe/LeanOeisProofs/NewFormalization/A368628.lean#L523\"]\ntheorem conjecture (n : ℕ) : Odd (a n) ↔ ∃ k : ℕ, n = (4 ^ k - 1) / 3 := by\n  sorry\n\nend OeisA368628\n",
  "statement_hash": "b636f359387af93db729ab0e4a03b366aec533d2116774af99c3c0d73ccede35",
  "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."
}