login
A236672
Start with 9; thereafter, primes obtained by concatenating to the end of previous term the next smallest number that will produce a prime.
1
9, 97, 971, 9719, 971917, 97191713, 9719171333, 971917133323, 9719171333237, 971917133323777, 97191713332377731, 9719171333237773159, 971917133323777315951, 97191713332377731595127, 971917133323777315951277, 971917133323777315951277269
OFFSET
1,1
COMMENTS
a(n+1) is the next smallest prime beginning with a(n). Initial term is 9. After a(1), these are the primes in A069611.
LINKS
EXAMPLE
a(1) = 9 by definition.
a(2) is the next smallest prime beginning with 9, so a(2) = 97.
a(3) is the next smallest prime beginning with 97, so a(3) = 971.
MAPLE
R:= 9: x:= 9:
for i from 2 to 20 do
for y from 1 by 2 do
z:= x*10^(1+ilog10(y)) + y;
if isprime(z) then
R:= R, z; x:= z; break
fi
od od:
R; # Robert Israel, Nov 22 2023
MATHEMATICA
next[p_]:=Module[{i=1, q}, While[!PrimeQ[q=10^IntegerLength[i]p+i], i+=2]; q];
NestList[next, 9, 15] (* Paolo Xausa, Nov 23 2023 *)
PROG
(Python)
import sympy
from sympy import isprime
def b(x):
num = str(x)
n = 1
while n < 10**3:
new_num = str(x) + str(n)
if isprime(int(new_num)):
print(int(new_num))
x = new_num
n = 1
else:
n += 1
b(9)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Derek Orr, Jan 29 2014
STATUS
approved