(Translated by https://www.hiragana.jp/)
A231426 - OEIS
login
A231426
Least prime such that at most n digits may be appended to the right, preserving primality at each step.
1
53, 11, 97, 17, 71, 43, 13, 2, 19, 103, 409, 1457011, 2744903797, 5232781111
OFFSET
0,1
FORMULA
a(n) is the least prime p=prime(k) such that A232128(p) (= A232127(k)) = n.
If a(n) = p, then a(n) = floor(A232129(p)/10^A232128(p)).
A232125(n) <= (a(n)+1)*10^n - 1. - Michael S. Branicky, Aug 15 2021
EXAMPLE
a(7) = 2 is the least prime which starts several sequences of 1+7 primes, e.g., (2, 23, 239, 2393, ..., 23399339) and others leading at most to 29399999 = A232129(2), where a digit is appended 7 times to yield a prime after each step, while it is not possible in any of the "branches" to append one more digit to the last term, preserving primality.
PROG
(Python)
from sympy import isprime, nextprime
def a(n):
p = 2
while True:
extends, reach = -1, {p}
while len(reach) > 0:
candidates = (int(str(e)+d) for d in "1379" for e in reach)
reach1 = set(filter(isprime, candidates))
extends, reach = extends + 1, reach1
if extends == n: return p
p = nextprime(p)
for n in range(12): print(a(n), end=", ") # Michael S. Branicky, Aug 15 2021
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Michel Marcus and M. F. Hasler, Nov 19 2013
EXTENSIONS
a(12)-a(13) from Michael S. Branicky, Aug 15 2021
STATUS
approved