/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ import FormalConjecturesUtil

Smallest $r$ such that (concatenation of $n$, $r$ times) $\cdot 10 + 1$ is prime

$a(n)$ is the smallest $r$ where (concatenation of $n$, $r$ times with itself) $\cdot 10 + 1$ is a prime, or $0$ if no such number exists. The number resulting from concatenating $n$, $r$ times, is $n \cdot \sum_{i=0}^{r-1} (10^d)^i$, where $d$ is the number of digits of $n$.

References:

namespace OeisA86766

Sequence $a(n)$ is the smallest $r > 0$ such that the concatenation of $n$, $r$ times with itself, multiplied by $10$ plus $1$, is prime, or $0$ if no such prime exists.

noncomputable def a (n : ) : := if n = 0 then 0 else let : := (Nat.digits 10 n).length let M : := 10 ^ let repCatVal (r : ) : := n * i Finset.range r, M ^ i let primeCandidate (r : ) : := repCatVal r * 10 + 1 sInf {r : | 0 < r (primeCandidate r).Prime}

Value of the sequence a at 0.

@[category test, AMS 11] theorem a_0 : a 0 = 0 := a 0 = 0 All goals completed! 🐙

Value of the sequence a at 1.

All goals completed! 🐙

Value of the sequence a at 2.

All goals completed! 🐙

Value of the sequence a at 3.

All goals completed! 🐙

Value of the sequence a at 4.

All goals completed! 🐙open scoped Classical in

What is the smallest integer $m > 1$ such that $a(10^m)$ is nonzero?

    Farideh Firoozbakht, Jan 07 2015

@[category research open, AMS 11] theorem conjecture1 : answer(sorry) = if h : m, 1 < m a (10 ^ m) 0 then some (sInf {m | 1 < m a (10 ^ m) 0}) else none := sorry = if h : m, 1 < m a (10 ^ m) 0 then some (sInf {m | 1 < m a (10 ^ m) 0}) else none All goals completed! 🐙

Conjecture: If $n$ is not of the form $10^m$ then $a(n)$ is nonzero.

    Farideh Firoozbakht, Jan 07 2015

@[category research open, AMS 11] theorem conjecture2 (n : ) (hn : 0 < n) (h : m : , n 10 ^ m) : a n 0 := n:hn:0 < nh: (m : ), n 10 ^ ma n 0 All goals completed! 🐙open scoped Classical in

What is the smallest odd prime $p$ such that $(10^{p^2}-1)/(10^p-1)$ is a prime number (and $a(10^{p-1})$ could be nonzero)?

    Farideh Firoozbakht, Jan 07 2015

@[category research open, AMS 11] theorem conjecture3 : answer(sorry) = if h : p, p.Prime 2 < p ((10 ^ (p ^ 2) - 1) / (10 ^ p - 1)).Prime then some (sInf {p | p.Prime 2 < p ((10 ^ (p ^ 2) - 1) / (10 ^ p - 1)).Prime}) else none := sorry = if h : p, Nat.Prime p 2 < p Nat.Prime ((10 ^ p ^ 2 - 1) / (10 ^ p - 1)) then some (sInf {p | Nat.Prime p 2 < p Nat.Prime ((10 ^ p ^ 2 - 1) / (10 ^ p - 1))}) else none All goals completed! 🐙end OeisA86766