{
  "id": "6939",
  "ident": "NS.06939",
  "slug": "oeis-87571",
  "title": "Smallest prime formed by concatenation $n, n-1, \\dots, n-k$",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: There are infinitely many composite numbers $n$ such that $a(n)$ is nonzero.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA87571.conjecture",
  "statement_lean": "theorem conjecture (M : ℕ) : ∃ n > M, 1 < n ∧ ¬ n.Prime ∧ a n ≠ 0",
  "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/-!\n# Smallest prime formed by concatenation $n, n-1, \\dots, n-k$\n\n$a(n)$ is the smallest prime which has the form of the concatenation\n$n, n-1, n-2, \\dots, n-k$ for some $k < n$, or $0$ if no such prime exists.\n\n*References:*\n- [A087571](https://oeis.org/A087571)-/\n\n@[expose] public section\n\nnamespace OeisA87571\n\n/-- Concatenate a list of numbers into a list of decimal digits in most-significant-first order. -/\ndef getAllDigitsMsf (L : List ℕ) : List ℕ :=\n  List.flatten (L.map fun k => (Nat.digits 10 k).reverse)\n\n/-- Convert a list of decimal digits (most significant first) to a natural number. -/\ndef ofDigitsMsf (D : List ℕ) : ℕ :=\n  D.foldl (fun acc d => acc * 10 + d) 0\n\n/-- Concatenation of numbers $n, n-1, \\dots, n-k$. -/\ndef concatNum (n : ℕ) (k : ℕ) : ℕ :=\n  ofDigitsMsf (getAllDigitsMsf ((List.range (k + 1)).map fun i => n - i))\n\n/-- Smallest prime of the form $n, n-1, \\dots, n-k$ for $k < n$, or $0$ if none exists. -/\ndef a (n : ℕ) : ℕ :=\n  match ((List.range n).map (concatNum n)).find? Nat.Prime with\n  | some p => p\n  | none => 0\n\n/-- Value of the sequence `a` at 0. -/\n@[category test, AMS 11]\ntheorem a_0 : a 0 = 0 := by decide\n\n/-- Value of the sequence `a` at 1. -/\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 0 := by decide\n\n/-- Value of the sequence `a` at 2. -/\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 2 := by decide\n\n/-- Value of the sequence `a` at 3. -/\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 3 := by decide\n\n/-- Value of the sequence `a` at 4. -/\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 43 := by decide\n\n/--\nConjecture: There are infinitely many composite numbers $n$ such that $a(n)$ is nonzero.-/\n@[category research open, AMS 11]\ntheorem conjecture (M : ℕ) : ∃ n > M, 1 < n ∧ ¬ n.Prime ∧ a n ≠ 0 := by\n  sorry\n\nend OeisA87571\n",
  "statement_hash": "eb4528a167c61b5fe9a5e96c66164897632e5cfde1bf53608def7644df48af1c",
  "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."
}