{
  "id": "6497",
  "ident": "NS.06497",
  "slug": "oeis-397588",
  "title": "A differential generating function",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "\"Conjecture: $a(n)$ is odd iff $n$ is a power of $2$ for $n \\ge 1$.\"\n- Paul D. Hanna, Jul 03 2026.\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": "OeisA397588.conjecture_parity",
  "statement_lean": "theorem conjecture_parity (n : ℕ) (hn : 1 ≤ n) :\n    Odd (a n) ↔ ∃ k : ℕ, n = 2 ^ k",
  "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 differential generating function\n\nThe generating function satisfies $A(x)=x+(xA(x)^2)'$. Its constant term is zero.\nSeiichi Manyama's recurrence is $a(1)=1$ and\n$a(n)=(n+1)\\sum_{k=1}^{n-1}a(k)a(n-k)$ for $n>1$.\n\n*References:*\n- [A397588](https://oeis.org/A397588)\n- [Li26] Wentao Li, [Parity and divisibility for A397588](https://github.com/VictorLiwentao/lean-oeis-proofs/blob/0a23974e54b90afd1453ef02c27cf8f617bad940/proofs/new-formalization/A397588/PROOF.md), 2026.\n-/\n\n@[expose] public section\n\nnamespace OeisA397588\n\n/-- Manyama's coefficient recurrence, extended by $a(0)=0$. -/\ndef a : ℕ → ℕ\n  | 0 => 0\n  | 1 => 1\n  | n + 2 =>\n    (n + 3) * ∑ k ∈ (Finset.Icc 1 (n + 1)).attach, a k.1 * a (n + 2 - k.1)\ntermination_by n => n\ndecreasing_by\n  · exact Nat.lt_succ_of_le (Finset.mem_Icc.mp k.2).2\n  · exact Nat.sub_lt (Nat.succ_pos _) (Finset.mem_Icc.mp k.2).1\n\n/-- The recurrence without attached membership proofs. -/\n@[category API, AMS 11]\ntheorem a_succ_succ (n : ℕ) :\n    a (n + 2) = (n + 3) * ∑ k ∈ Finset.Icc 1 (n + 1), a k * a (n + 2 - k) := by\n  simp only [a]\n  exact congrArg (fun t => (n + 3) * t)\n    (Finset.sum_attach (Finset.Icc 1 (n + 1)) (fun k => a k * a (n + 2 - k)))\n\n/-- Manyama's recurrence for every index greater than one. -/\n@[category API, AMS 11]\ntheorem a_of_gt_one {n : ℕ} (hn : 1 < n) :\n    a n = (n + 1) * ∑ k ∈ Finset.Icc 1 (n - 1), a k * a (n - k) := by\n  cases n with\n  | zero => omega\n  | succ n =>\n    cases n with\n    | zero => omega\n    | succ n => simp [a_succ_succ]\n\n@[category test, AMS 11]\ntheorem a_0 : a 0 = 0 := by\n  simp only [a]\n\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 1 := by\n  simp only [a]\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 3 := by\n  have hI : Finset.Icc (1 : ℕ) (2 - 1) = {1} := by decide\n  rw [a_of_gt_one (by decide : 1 < 2), hI]\n  norm_num [a_1]\n\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 24 := by\n  have hI : Finset.Icc (1 : ℕ) (3 - 1) = {1, 2} := by decide\n  rw [a_of_gt_one (by decide : 1 < 3), hI]\n  norm_num [a_1, a_2]\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 285 := by\n  have hI : Finset.Icc (1 : ℕ) (4 - 1) = {1, 2, 3} := by decide\n  rw [a_of_gt_one (by decide : 1 < 4), hI]\n  norm_num [a_1, a_2, a_3]\n\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 4284 := by\n  have hI : Finset.Icc (1 : ℕ) (5 - 1) = {1, 2, 3, 4} := by decide\n  rw [a_of_gt_one (by decide : 1 < 5), hI]\n  norm_num [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 iff $n$ is a power of $2$ for $n \\ge 1$.\"\n- Paul D. Hanna, Jul 03 2026.\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/0a23974e54b90afd1453ef02c27cf8f617bad940/LeanOeisProofs/NewFormalization/A397588.lean#L211\"]\ntheorem conjecture_parity (n : ℕ) (hn : 1 ≤ n) :\n    Odd (a n) ↔ ∃ k : ℕ, n = 2 ^ k := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\n\"$a(n)$ divisible by $3$ for $n > 1$.\"\n- Paul D. Hanna, Jul 03 2026.\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/0a23974e54b90afd1453ef02c27cf8f617bad940/LeanOeisProofs/NewFormalization/A397588.lean#L325\"]\ntheorem three_dvd_a (n : ℕ) (hn : 1 < n) : 3 ∣ a n := by\n  sorry\n\nend OeisA397588\n",
  "statement_hash": "cbde5aaa1707e9b2b4206f84026ec56498fe1fe6a6b22a635e2f31c8c07cc553",
  "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."
}