{
  "id": "6374",
  "ident": "NS.06374",
  "slug": "oeis-368634",
  "title": "A generating function with signed square terms",
  "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 12 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": "OeisA368634.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 signed square terms\n\nThe sequence consists of the coefficients of\n$A(x)=1+x(3A(x)^2-A(-x)^2)/2$.\n\n*References:*\n- [A368634](https://oeis.org/A368634)\n- [Li26] Wentao Li, [Generating-function bridge and parity for A368634](https://github.com/VictorLiwentao/lean-oeis-proofs/blob/9d4a205da2a4094800f9c600a7b0b5223eda51ce/proofs/new-proofs/A368634/PROOF.md), 2026.\n-/\n\n@[expose] public section\n\nnamespace OeisA368634\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 $A(x)=1+x(3A(x)^2-A(-x)^2)/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 2 else 1) * conv2 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 2 else 1) * conv2 (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 [conv2, Finset.sum_range_succ, a_0]\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 4 := by\n  rw [a_eq]\n  norm_num [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 [conv2, Finset.sum_range_succ, a_0, a_1, a_2]\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 52 := by\n  rw [a_eq]\n  norm_num [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 [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 12 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/A368634.lean#L407\"]\ntheorem conjecture (n : ℕ) : Odd (a n) ↔ ∃ k : ℕ, n = 2 ^ k - 1 := by\n  sorry\n\nend OeisA368634\n",
  "statement_hash": "a22a40dc23373bc4912a7f34276163b1099190a4289028b4bd4aab19f8105f8e",
  "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."
}