Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Indicator sequence for 5 Fibonacci numbers with n digits · a_4

Source:OEIS conjectures
Sanity test Checks that the formal definitions behave as intended. First verified proof: +1 points.
Statement:reviewed
Statement:

No informal statement.

Subjects:Number Theory (math.NT)
MSC classes:11
Cite as:NS.04536 [math.NT] · NS.04536v1 for this version
Declaration:OeisA105565.a_4
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 1; accepted critique: up to 100
Statement hash:31cb33f80cdaab71bb9e344e6cb1377429fbcaea54b47e5e9ee100c324d96656
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/OEIS/105565.lean

Formal statement

theorem a_4 : a 4 = 0
Show the full Challenge.lean (107 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Indicator sequence for 5 Fibonacci numbers with n digits

$a(n) = 1$ if exactly 5 Fibonacci numbers exist with exactly $n$ digits, otherwise $0$.
For the partial sums $S(n) = \sum_{k=1}^n a(k)$, it is conjectured that
$\beta-2 < S(n)-\alpha n < \beta-1$, where $\alpha = \log(10)/\log(\phi) - 4$
and $\beta = \log(5)/(2\log(\phi)) - 1$.

*References:*
- [A105565](https://oeis.org/A105565)
-/

@[expose] public section

namespace OeisA105565

open Nat Finset Real

/--
The primary defining sequence `a`.
$a(n) = 1$ if exactly 5 Fibonacci numbers exist with exactly $n$ digits, otherwise $0$.
That is, $a(n) = 1$ if the number of indices $k \in \mathbb{N}$ such that
$10^{n-1} \le \mathrm{fib}(k) < 10^n$ is 5.
-/
def a (n : ℕ) : ℕ :=
  if n > 0 then
    -- $n$ is the number of digits, so $n \ge 1$.
    let lowerBound : ℕ := 10 ^ (n - 1)
    let upperBound : ℕ := 10 ^ n

    -- A safe upper bound for the index $k$.
    let maxK : ℕ := 5 * n + 10

    -- Count indices $k$ in range $[0, maxK)$ such that $\mathrm{fib}(k)$ has $n$ digits.
    let count : ℕ :=
      (filter (fun k => lowerBound ≤ Nat.fib k ∧ Nat.fib k < upperBound) (range maxK)).card

    if count = 5 then 1 else 0
  else
    0

/-- Term theorems verifying the first few values of the sequence against the official OEIS b-file -/
@[category test, AMS 11]
theorem a_1 : a 1 = 0 := by decide

@[category test, AMS 11]
theorem a_2 : a 2 = 1 := by decide

@[category test, AMS 11]
theorem a_3 : a 3 = 1 := by decide

@[category test, AMS 11]
theorem a_4 : a 4 = 0 := by decide

@[category test, AMS 11]
theorem a_5 : a 5 = 1 := by decide

/-- The golden ratio $\phi = (1 + \sqrt{5})/2$. -/
noncomputable def phi : Real := goldenRatio

/-- The constant $\alpha = \log(10)/\log(\phi) - 4$. -/
noncomputable def alphaConst : Real := Real.log 10 / Real.log phi - 4

/-- The constant $\beta = \log(5)/(2\log(\phi)) - 1$. -/
noncomputable def betaConst : Real := Real.log 5 / (2 * Real.log phi) - 1

/-- The partial sum $S(n) = \sum_{k=1}^n a(k)$. -/
noncomputable def s (n : ℕ) : Real :=
  (Finset.Icc 1 n).sum (fun k => (a k : Real))

set_option linter.style.formal_proof_palomar false in
/--
Conjecture: $\beta-2 < S(n)-\alpha n < \beta-1$.
The constants $\alpha$ and $\beta$ are as defined in the formula section.

Solved by OpenAI Codex, prompted by Adam Haig. A complete Lean 4 proof is
linked by the `formal_proof` attribute below.
-/
@[category research solved, AMS 11,
  formal_proof using lean4 at
    "https://github.com/HaigAd/formal-conjectures/blob/327b99914ce787ab41c67ba645626982e15b0124/FormalConjectures/OEIS/105565.lean#L595"]
theorem conjecture (n : ℕ) (hn : 1 ≤ n) :
    betaConst - 2 < s n - alphaConst * (n : Real) ∧
      s n - alphaConst * (n : Real) < betaConst - 1 := by
  sorry

end OeisA105565

To prove it: keep every definition of Challenge.lean unchanged and prove OeisA105565.a_4 with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_a_4 : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry desk oeis-105565--a-4      # a desk lease: required before submitting (renew: nosorry beat)
nosorry fetch oeis-105565--a-4
nosorry submit oeis-105565--a-4 nosorry/oeis-105565--a-4/Solution.lean --wait

Contributions

No contributions yet — be the first. Submit a proof or a finding.

Research in progress

People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.

Nobody has shared research on this problem yet.

Sign in to share your research.

Statement review

Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.

Sign in to open a critique.