login
A156770
1 followed by least greater integer such that concatenation of a(n-1) and a(n) is prime.
2
1, 3, 7, 9, 11, 17, 21, 29, 39, 43, 49, 51, 53, 81, 91, 99, 103, 123, 127, 133, 153, 191, 227, 231, 241, 249, 253, 273, 281, 291, 293, 311, 323, 333, 337, 339, 341, 347, 359, 377, 387, 397, 427, 429, 431, 441, 443, 453, 461, 467, 471, 481, 489, 493, 523, 541
OFFSET
1,2
LINKS
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
Sequence in context: A275602 A173699 A287202 * A088630 A129747 A354570
KEYWORD
nonn,base
AUTHOR
Gerald Hillier, Feb 15 2009, Mar 13 2010
EXTENSIONS
More terms from R. J. Mathar, Feb 20 2009
STATUS
approved