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
Robert Israel, Table of n, a(n) for n = 1..316
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