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

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Number of times nn occurs as a binary sub-pattern of n2n^2

Source:OEIS conjectures
Known result Solved on paper; nobody has proved it in Lean here yet. First verified proof: +10 points.
Statement:reviewed
Statement:

Is a(n)≤1a(n) \le 1 for all nn?

Subjects:Number Theory (math.NT)
MSC classes:11
Tags:formal_proof
Cite as:NS.06828 [math.NT] · NS.06828v1 for this version
Declaration:OeisA76141.conjecture
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 10, later ones: 2; accepted critique: up to 60
Statement hash:cc668f3b56f2ccd54786c6b5191da154e679c91c0d820960ed0d9d213917cecd
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/OEIS/76141.lean

Formal statement

theorem conjecture (n : ℕ) : a n ≤ 1
Show the full Challenge.lean (85 lines) — definitions included
module

public import FormalConjecturesUtil


/-!
# Number of times $n$ occurs as a binary sub-pattern of $n^2$

The sequence $a(n)$ is the number of times the binary expansion of $n$ appears as a contiguous
sublist (infix) in the binary expansion of $n^2$.

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

@[expose] public section

namespace OeisA76141

/-- The binary representation of a natural number $n$, most significant bit first.
For $n = 0$, this is $[0]$. -/
def binaryPattern (n : ℕ) : List ℕ :=
  if n = 0 then [0] else (Nat.digits 2 n).reverse

/-- Number of times the binary pattern of $n$ occurs as an infix of the binary pattern of $n^2$. -/
def a (n : ℕ) : ℕ :=
  let pat := binaryPattern n
  let tgt := binaryPattern (n ^ 2)
  tgt.tails.countP (pat.isPrefixOf ·)

/-- Value of the sequence `a` at 0. -/
@[category test, AMS 11]
theorem a_0 : a 0 = 1 := by
  decide +kernel

/-- Value of the sequence `a` at 1. -/
@[category test, AMS 11]
theorem a_1 : a 1 = 1 := by
  decide +kernel

/-- Value of the sequence `a` at 2. -/
@[category test, AMS 11]
theorem a_2 : a 2 = 1 := by
  decide +kernel

/-- Value of the sequence `a` at 3. -/
@[category test, AMS 11]
theorem a_3 : a 3 = 0 := by
  decide +kernel

/-- Value of the sequence `a` at 4. -/
@[category test, AMS 11]
theorem a_4 : a 4 = 1 := by
  decide +kernel

/-- Value of the sequence `a` at 5. -/
@[category test, AMS 11]
theorem a_5 : a 5 = 0 := by
  decide +kernel

set_option linter.style.formal_proof_palomar false in
/--
Is $a(n) \le 1$ for all $n$?-/
@[category research solved, AMS 11,
  formal_proof using lean4 at
    "https://github.com/KitaKen1/oeis-a076141-binary-word/blob/b4e179767fa3041c43e019b559ee77e6737317aa/lean/OeisA76141FC.lean#L1229-L1253"]
theorem conjecture (n : ℕ) : a n ≤ 1 := by
  sorry

end OeisA76141

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

nosorry fetch oeis-76141
nosorry submit oeis-76141 nosorry/oeis-76141/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.