{
  "id": "6919",
  "ident": "NS.06919",
  "slug": "oeis-86766",
  "title": "Smallest $r$ such that (concatenation of $n$, $r$ times) $\\cdot 10 + 1$ is prime",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "What is the smallest integer $m > 1$ such that $a(10^m)$ is nonzero?\n- _Farideh Firoozbakht_, Jan 07 2015",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA86766.conjecture1",
  "statement_lean": "theorem conjecture1 :\n    conjecture1.answer =\n      if h : ∃ m, 1 < m ∧ a (10 ^ m) ≠ 0 then\n        some (sInf {m | 1 < m ∧ a (10 ^ m) ≠ 0})\n      else\n        none",
  "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 $r$ such that (concatenation of $n$, $r$ times) $\\cdot 10 + 1$ is prime\n\n$a(n)$ is the smallest $r$ where (concatenation of $n$, $r$ times with itself) $\\cdot 10 + 1$\nis a prime, or $0$ if no such number exists.\nThe number resulting from concatenating $n$, $r$ times, is\n$n \\cdot \\sum_{i=0}^{r-1} (10^d)^i$, where $d$ is the number of digits of $n$.\n\n*References:*\n- [A086766](https://oeis.org/A086766)-/\n\n@[expose] public section\n\nnamespace OeisA86766\n\n/-- Sequence $a(n)$ is the smallest $r > 0$ such that the concatenation of $n$, $r$ times\nwith itself, multiplied by $10$ plus $1$, is prime, or $0$ if no such prime exists. -/\nnoncomputable def a (n : ℕ) : ℕ :=\n  if n = 0 then 0\n  else\n    let ℓ : ℕ := (Nat.digits 10 n).length\n    let M : ℕ := 10 ^ ℓ\n    let repCatVal (r : ℕ) : ℕ := n * ∑ i ∈ Finset.range r, M ^ i\n    let primeCandidate (r : ℕ) : ℕ := repCatVal r * 10 + 1\n    sInf {r : ℕ | 0 < r ∧ (primeCandidate r).Prime}\n\n/-- Value of the sequence `a` at 0. -/\n@[category test, AMS 11]\ntheorem a_0 : a 0 = 0 := by rfl\n\n/-- Value of the sequence `a` at 1. -/\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 1 := by\n  have h_least : IsLeast {r : ℕ | 0 < r ∧ ((1 * ∑ i ∈ Finset.range r, (10 ^ (Nat.digits 10\n  1).length) ^ i) * 10 + 1).Prime} 1 := by\n    constructor\n    · simp only [Set.mem_ofPred_eq]\n      refine ⟨by omega, ?_⟩\n      have : (Nat.digits 10 1).length = 1 := by decide\n      rw [this]\n      norm_num\n    · intro r hr\n      simp only [Set.mem_ofPred_eq] at hr\n      exact hr.1\n  have ha1 : a 1 = sInf {r : ℕ | 0 < r ∧ ((1 * ∑ i ∈ Finset.range r, (10 ^ (Nat.digits 10\n  1).length) ^ i) * 10 + 1).Prime} := by\n    unfold a\n    split <;> [omega; rfl]\n  rw [ha1, h_least.csInf_eq]\n\n/-- Value of the sequence `a` at 2. -/\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 3 := by\n  have h_digits : (Nat.digits 10 2).length = 1 := by decide\n  have h_least : IsLeast {r : ℕ | 0 < r ∧ ((2 * ∑ i ∈ Finset.range r, (10 ^ (Nat.digits 10\n  2).length) ^ i) * 10 + 1).Prime} 3 := by\n    constructor\n    · simp only [Set.mem_ofPred_eq]\n      refine ⟨by omega, ?_⟩\n      rw [h_digits]\n      norm_num\n    · intro r hr\n      simp only [Set.mem_ofPred_eq] at hr\n      by_contra! h\n      have hr_pos := hr.1\n      interval_cases r\n      · have hr2 := hr.2\n        rw [h_digits] at hr2\n        revert hr2\n        norm_num\n      · have hr2 := hr.2\n        rw [h_digits] at hr2\n        revert hr2\n        norm_num\n  have ha2 : a 2 = sInf {r : ℕ | 0 < r ∧ ((2 * ∑ i ∈ Finset.range r, (10 ^ (Nat.digits 10\n  2).length) ^ i) * 10 + 1).Prime} := by\n    unfold a\n    split <;> [omega; rfl]\n  rw [ha2, h_least.csInf_eq]\n\n/-- Value of the sequence `a` at 3. -/\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 1 := by\n  have h_least : IsLeast {r : ℕ | 0 < r ∧ ((3 * ∑ i ∈ Finset.range r, (10 ^ (Nat.digits 10\n  3).length) ^ i) * 10 + 1).Prime} 1 := by\n    constructor\n    · simp only [Set.mem_ofPred_eq]\n      refine ⟨by omega, ?_⟩\n      have : (Nat.digits 10 3).length = 1 := by decide\n      rw [this]\n      norm_num\n    · intro r hr\n      simp only [Set.mem_ofPred_eq] at hr\n      exact hr.1\n  have ha3 : a 3 = sInf {r : ℕ | 0 < r ∧ ((3 * ∑ i ∈ Finset.range r, (10 ^ (Nat.digits 10\n  3).length) ^ i) * 10 + 1).Prime} := by\n    unfold a\n    split <;> [omega; rfl]\n  rw [ha3, h_least.csInf_eq]\n\n/-- Value of the sequence `a` at 4. -/\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 1 := by\n  have h_least : IsLeast {r : ℕ | 0 < r ∧ ((4 * ∑ i ∈ Finset.range r, (10 ^ (Nat.digits 10\n  4).length) ^ i) * 10 + 1).Prime} 1 := by\n    constructor\n    · simp only [Set.mem_ofPred_eq]\n      refine ⟨by omega, ?_⟩\n      have : (Nat.digits 10 4).length = 1 := by decide\n      rw [this]\n      norm_num\n    · intro r hr\n      simp only [Set.mem_ofPred_eq] at hr\n      exact hr.1\n  have ha4 : a 4 = sInf {r : ℕ | 0 < r ∧ ((4 * ∑ i ∈ Finset.range r, (10 ^ (Nat.digits 10\n  4).length) ^ i) * 10 + 1).Prime} := by\n    unfold a\n    split <;> [omega; rfl]\n  rw [ha4, h_least.csInf_eq]\n\ndef conjecture1.answer : Option ℕ := sorry\n\nopen scoped Classical in\n/--\nWhat is the smallest integer $m > 1$ such that $a(10^m)$ is nonzero?\n- _Farideh Firoozbakht_, Jan 07 2015\n-/\n@[category research open, question value, AMS 11]\ntheorem conjecture1 :\n    conjecture1.answer =\n      if h : ∃ m, 1 < m ∧ a (10 ^ m) ≠ 0 then\n        some (sInf {m | 1 < m ∧ a (10 ^ m) ≠ 0})\n      else\n        none := by\n  sorry\n\n\n/--\nConjecture: If $n$ is not of the form $10^m$ then $a(n)$ is nonzero.\n- _Farideh Firoozbakht_, Jan 07 2015\n-/\n@[category research open, AMS 11]\ntheorem conjecture2 (n : ℕ) (hn : 0 < n) (h : ∀ m : ℕ, n ≠ 10 ^ m) : a n ≠ 0 := by\n  sorry\n\ndef conjecture3.answer : Option ℕ := sorry\n\nopen scoped Classical in\n/--\nWhat is the smallest odd prime $p$ such that $(10^{p^2}-1)/(10^p-1)$ is a prime number\n(and $a(10^{p-1})$ could be nonzero)?\n- _Farideh Firoozbakht_, Jan 07 2015\n-/\n@[category research open, question value, AMS 11]\ntheorem conjecture3 :\n    conjecture3.answer =\n      if h : ∃ p, p.Prime ∧ 2 < p ∧ ((10 ^ (p ^ 2) - 1) / (10 ^ p - 1)).Prime then\n        some (sInf {p | p.Prime ∧ 2 < p ∧ ((10 ^ (p ^ 2) - 1) / (10 ^ p - 1)).Prime})\n      else\n        none := by\n  sorry\n\nend OeisA86766\n\n",
  "statement_hash": "6d83877171fc32c8250da639615d6ae91deaf3bb25505c73530edcb3db7b5199",
  "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."
}