{
  "id": "4538",
  "ident": "NS.04538",
  "slug": "oeis-105565",
  "title": "Indicator sequence for 5 Fibonacci numbers with n digits",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: $\\beta-2 < S(n)-\\alpha n < \\beta-1$.\nThe constants $\\alpha$ and $\\beta$ are as defined in the formula section.\n\nSolved by OpenAI Codex, prompted by Adam Haig. A complete Lean 4 proof is\nlinked by the `formal_proof` attribute below.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA105565.conjecture",
  "statement_lean": "theorem conjecture (n : ℕ) (hn : 1 ≤ n) :\n    betaConst - 2 < s n - alphaConst * (n : Real) ∧\n      s n - alphaConst * (n : Real) < betaConst - 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# Indicator sequence for 5 Fibonacci numbers with n digits\n\n$a(n) = 1$ if exactly 5 Fibonacci numbers exist with exactly $n$ digits, otherwise $0$.\nFor the partial sums $S(n) = \\sum_{k=1}^n a(k)$, it is conjectured that\n$\\beta-2 < S(n)-\\alpha n < \\beta-1$, where $\\alpha = \\log(10)/\\log(\\phi) - 4$\nand $\\beta = \\log(5)/(2\\log(\\phi)) - 1$.\n\n*References:*\n- [A105565](https://oeis.org/A105565)\n-/\n\n@[expose] public section\n\nnamespace OeisA105565\n\nopen Nat Finset Real\n\n/--\nThe primary defining sequence `a`.\n$a(n) = 1$ if exactly 5 Fibonacci numbers exist with exactly $n$ digits, otherwise $0$.\nThat is, $a(n) = 1$ if the number of indices $k \\in \\mathbb{N}$ such that\n$10^{n-1} \\le \\mathrm{fib}(k) < 10^n$ is 5.\n-/\ndef a (n : ℕ) : ℕ :=\n  if n > 0 then\n    -- $n$ is the number of digits, so $n \\ge 1$.\n    let lowerBound : ℕ := 10 ^ (n - 1)\n    let upperBound : ℕ := 10 ^ n\n\n    -- A safe upper bound for the index $k$.\n    let maxK : ℕ := 5 * n + 10\n\n    -- Count indices $k$ in range $[0, maxK)$ such that $\\mathrm{fib}(k)$ has $n$ digits.\n    let count : ℕ :=\n      (filter (fun k => lowerBound ≤ Nat.fib k ∧ Nat.fib k < upperBound) (range maxK)).card\n\n    if count = 5 then 1 else 0\n  else\n    0\n\n/-- Term theorems verifying the first few values of the sequence against the official OEIS b-file -/\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 0 := by decide\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 1 := by decide\n\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 1 := by decide\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 0 := by decide\n\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 1 := by decide\n\n/-- The golden ratio $\\phi = (1 + \\sqrt{5})/2$. -/\nnoncomputable def phi : Real := goldenRatio\n\n/-- The constant $\\alpha = \\log(10)/\\log(\\phi) - 4$. -/\nnoncomputable def alphaConst : Real := Real.log 10 / Real.log phi - 4\n\n/-- The constant $\\beta = \\log(5)/(2\\log(\\phi)) - 1$. -/\nnoncomputable def betaConst : Real := Real.log 5 / (2 * Real.log phi) - 1\n\n/-- The partial sum $S(n) = \\sum_{k=1}^n a(k)$. -/\nnoncomputable def s (n : ℕ) : Real :=\n  (Finset.Icc 1 n).sum (fun k => (a k : Real))\n\nset_option linter.style.formal_proof_palomar false in\n/--\nConjecture: $\\beta-2 < S(n)-\\alpha n < \\beta-1$.\nThe constants $\\alpha$ and $\\beta$ are as defined in the formula section.\n\nSolved by OpenAI Codex, prompted by Adam Haig. A complete Lean 4 proof is\nlinked by the `formal_proof` attribute below.\n-/\n@[category research solved, AMS 11,\n  formal_proof using lean4 at\n    \"https://github.com/HaigAd/formal-conjectures/blob/327b99914ce787ab41c67ba645626982e15b0124/FormalConjectures/OEIS/105565.lean#L595\"]\ntheorem conjecture (n : ℕ) (hn : 1 ≤ n) :\n    betaConst - 2 < s n - alphaConst * (n : Real) ∧\n      s n - alphaConst * (n : Real) < betaConst - 1 := by\n  sorry\n\nend OeisA105565\n",
  "statement_hash": "31cb33f80cdaab71bb9e344e6cb1377429fbcaea54b47e5e9ee100c324d96656",
  "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."
}