{
  "id": "6788",
  "ident": "NS.06788",
  "slug": "oeis-70823",
  "title": "Recurrence $a(n+2) = |a(n+1)a(n) - a(n)a(n+1)|$ via concatenation",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "$a(n) \\equiv 0 \\pmod 3$ if $n > 2$. Is $a(n)$ always of the form $2^j \\cdot 3^k \\cdot s$\nwhere $s$ is a squarefree number?\n\nAnswer: False, $a(20)$ is divisible by $13^2$ but not by $13^3$.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question",
    "formal_proof"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA70823.conjecture",
  "statement_lean": "theorem conjecture :\n    ¬ ∀ n : ℕ, 2 < n →\n      a n ≡ 0 [MOD 3] ∧\n        ∃ j k s : ℕ, a n = 2 ^ j * 3 ^ k * s ∧ Squarefree s",
  "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# Recurrence $a(n+2) = |a(n+1)a(n) - a(n)a(n+1)|$ via concatenation\n\nThe sequence starts with $a(1) = 0, a(2) = 1$. For $n \\ge 1$,\n$$a(n+2) = |\\text{concat}(a(n+1), a(n)) - \\text{concat}(a(n), a(n+1))|$$\nwhere concatenation is in decimal representation.\n\n*References:*\n- [A070823](https://oeis.org/A070823)\n-/\n\n@[expose] public section\n\nnamespace OeisA70823\n\n/-- Number of digits of a natural number $n$ in base 10 (with 1 digit for 0). -/\ndef numDigitsBase10 (n : ℕ) : ℕ :=\n  if n = 0 then 1 else Nat.log 10 n + 1\n\n/-- Concatenate $x$ followed by $y$ in base 10. -/\ndef concatenate (x y : ℕ) : ℕ :=\n  x * 10 ^ (numDigitsBase10 y) + y\n\n/-- The sequence $a(1)=0, a(2)=1, a(n+2)=|\\text{concat}(a(n+1),a(n))-\\text{concat}(a(n),a(n+1))|$. -/\ndef a : ℕ → ℕ\n  | 0 => 0\n  | 1 => 0\n  | 2 => 1\n  | n + 3 =>\n    let cat1 := concatenate (a (n + 2)) (a (n + 1))\n    let cat2 := concatenate (a (n + 1)) (a (n + 2))\n    ((cat1 : ℤ) - (cat2 : ℤ)).natAbs\n\n/-- Value of the sequence `a` at 1. -/\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 0 := by\n  decide\n\n/-- Value of the sequence `a` at 2. -/\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 1 := by\n  decide\n\n/-- Value of the sequence `a` at 3. -/\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 9 := by\n  decide\n\n/-- Value of the sequence `a` at 4. -/\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 72 := by\n  decide\n\n/-- Value of the sequence `a` at 5. -/\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 243 := by\n  decide\n\nset_option linter.style.formal_proof_palomar false in\n/--\n$a(n) \\equiv 0 \\pmod 3$ if $n > 2$. Is $a(n)$ always of the form $2^j \\cdot 3^k \\cdot s$\nwhere $s$ is a squarefree number?\n\nAnswer: False, $a(20)$ is divisible by $13^2$ but not by $13^3$.\n-/\n@[category research solved, question, AMS 11,\n  formal_proof using lean4 at\n    \"https://github.com/KitaKen1/oeis-a070823-counterexample/blob/51399770e734616c6463be034e41f7469991d752/lean/OeisA70823CounterexampleFC.lean#L72-L81\"]\ntheorem conjecture :\n    ¬ ∀ n : ℕ, 2 < n →\n      a n ≡ 0 [MOD 3] ∧\n        ∃ j k s : ℕ, a n = 2 ^ j * 3 ^ k * s ∧ Squarefree s := by\n  sorry\n\nend OeisA70823\n",
  "statement_hash": "51c649600325fac38f7e852c4057d38aab7732d6b444cd03ad8e892298abf8c0",
  "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."
}