login
1 followed by least greater integer such that concatenation of a(n-1) and a(n) is prime.
2

%I #16 Oct 18 2022 01:26:55

%S 1,3,7,9,11,17,21,29,39,43,49,51,53,81,91,99,103,123,127,133,153,191,

%T 227,231,241,249,253,273,281,291,293,311,323,333,337,339,341,347,359,

%U 377,387,397,427,429,431,441,443,453,461,467,471,481,489,493,523,541

%N 1 followed by least greater integer such that concatenation of a(n-1) and a(n) is prime.

%H Paolo P. Lava, <a href="/A156770/b156770.txt">Table of n, a(n) for n = 1..10000</a>

%e The term immediately after 17 is 21 because 1721 is the first prime greater than 1717.

%p 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

%t 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 *)

%o (Python)

%o from sympy import isprime

%o from itertools import islice

%o def agen():

%o an = 1

%o while True:

%o yield an

%o s, an = str(an), an+1

%o while not isprime(int(s+str(an))): an += 1

%o print(list(islice(agen(), 56))) # _Michael S. Branicky_, Oct 17 2022

%K nonn,base

%O 1,2

%A _Gerald Hillier_, Feb 15 2009, Mar 13 2010

%E More terms from _R. J. Mathar_, Feb 20 2009