OFFSET
1,2
LINKS
Paolo P. Lava, Table of n, a(n) for n = 1..10000
EXAMPLE
The term immediately after 17 is 21 because 1721 is the first prime greater than 1717.
MAPLE
cat2 := proc(a, b) a*10^(max(1, ilog10(b)+1))+b ; end: A156770 := proc(n) option remember ; local a; if n = 1 then 1; else for a from procname(n-1)+1 do if isprime( cat2(procname(n-1), a) ) then RETURN(a) ; fi; od: fi; end: seq(A156770(n), n=1..80) ; # R. J. Mathar, Feb 20 2009
MATHEMATICA
nxt[n_]:=Module[{k=n+2, idn=IntegerDigits[n]}, While[!PrimeQ[ FromDigits[ Join[ idn, IntegerDigits[ k]]]], k = k+2]; k]; NestList[nxt, 1, 60] (* Harvey P. Dale, Jul 09 2015 *)
PROG
(Python)
from sympy import isprime
from itertools import islice
def agen():
an = 1
while True:
yield an
s, an = str(an), an+1
while not isprime(int(s+str(an))): an += 1
print(list(islice(agen(), 56))) # Michael S. Branicky, Oct 17 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Gerald Hillier, Feb 15 2009, Mar 13 2010
EXTENSIONS
More terms from R. J. Mathar, Feb 20 2009
STATUS
approved