{
  "id": "5414",
  "ident": "NS.05414",
  "slug": "oeis-22030",
  "title": "A nonlinear recurrence sequence",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: $a(n) = 4 a(n-1) - a(n-3) + a(n-4)$.\n- Colin Barker, Feb 16 2012",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA22030.conjecture",
  "statement_lean": "theorem conjecture (n : ℕ) (hn : 4 ≤ n) :\n    a n = 4 * a (n - 1) - a (n - 3) + a (n - 4)",
  "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 nonlinear recurrence sequence\n\nFor even $n$, $a(n+2)$ is the greatest integer such that $a(n+2)/a(n+1) < a(n+1)/a(n)$;\nfor odd $n$, the least integer such that $a(n+2)/a(n+1) > a(n+1)/a(n)$;\n$a(0) = 4, a(1) = 16$.\n\n*References:*\n- [A022030](https://oeis.org/A022030)\n-/\n\n@[expose] public section\n\nnamespace OeisA22030\n\n/--\nFor even $n$, $a(n+2)$ is the greatest integer such that $a(n+2)/a(n+1) < a(n+1)/a(n)$;\nfor odd $n$, the least integer such that $a(n+2)/a(n+1) > a(n+1)/a(n)$;\n$a(0) = 4, a(1) = 16$.\n-/\ndef a (n : ℕ) : ℕ :=\n  match n with\n  | 0 => 4\n  | 1 => 16\n  | n + 2 =>\n    if Even n then\n      (a (n + 1) ^ 2 + a n - 1) / a n - 1\n    else\n      (a (n + 1) ^ 2) / a n + 1\n\n@[category test, AMS 11]\ntheorem a_0 : a 0 = 4 := by rfl\n\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 16 := by rfl\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 63 := by rfl\n\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 249 := by rfl\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 984 := by rfl\n\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 3889 := by rfl\n\nset_option linter.style.formal_proof_palomar false in\n/--\nConjecture: $a(n) = 4 a(n-1) - a(n-3) + a(n-4)$.\n- Colin Barker, Feb 16 2012\n-/\n@[category research solved, AMS 11,\n  formal_proof using lean4 at\n    \"https://github.com/KitaKen1/oeis-a022030-lean/blob/f74afc2/lean/OeisA22030FC.lean#L270-L275\"]\ntheorem conjecture (n : ℕ) (hn : 4 ≤ n) :\n    a n = 4 * a (n - 1) - a (n - 3) + a (n - 4) := by\n  sorry\n\nend OeisA22030\n",
  "statement_hash": "4b0f6b1e957e08f057b9306f7eb01879246ec20df504feca626e5a328ebca39e",
  "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."
}