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

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Smallest prime formed by concatenation n,n−1,…,n−kn, n-1, \dots, n-k · a_0

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

Value of the sequence a at 0.

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

Formal statement

theorem a_0 : a 0 = 0
Show the full Challenge.lean (79 lines) — definitions included
module

public import FormalConjecturesUtil


/-!
# Smallest prime formed by concatenation $n, n-1, \dots, n-k$

$a(n)$ is the smallest prime which has the form of the concatenation
$n, n-1, n-2, \dots, n-k$ for some $k < n$, or $0$ if no such prime exists.

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

@[expose] public section

namespace OeisA87571

/-- Concatenate a list of numbers into a list of decimal digits in most-significant-first order. -/
def getAllDigitsMsf (L : List ℕ) : List ℕ :=
  List.flatten (L.map fun k => (Nat.digits 10 k).reverse)

/-- Convert a list of decimal digits (most significant first) to a natural number. -/
def ofDigitsMsf (D : List ℕ) : ℕ :=
  D.foldl (fun acc d => acc * 10 + d) 0

/-- Concatenation of numbers $n, n-1, \dots, n-k$. -/
def concatNum (n : ℕ) (k : ℕ) : ℕ :=
  ofDigitsMsf (getAllDigitsMsf ((List.range (k + 1)).map fun i => n - i))

/-- Smallest prime of the form $n, n-1, \dots, n-k$ for $k < n$, or $0$ if none exists. -/
def a (n : ℕ) : ℕ :=
  match ((List.range n).map (concatNum n)).find? Nat.Prime with
  | some p => p
  | none => 0

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

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

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

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

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

/--
Conjecture: There are infinitely many composite numbers $n$ such that $a(n)$ is nonzero.-/
@[category research open, AMS 11]
theorem conjecture (M : ℕ) : ∃ n > M, 1 < n ∧ ¬ n.Prime ∧ a n ≠ 0 := by
  sorry

end OeisA87571

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

nosorry desk oeis-87571--a-0      # a desk lease: required before submitting (renew: nosorry beat)
nosorry fetch oeis-87571--a-0
nosorry submit oeis-87571--a-0 nosorry/oeis-87571--a-0/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.