%I #9 Aug 15 2016 09:16:49
%S 2,3,11,23,31,41,59,79,97,107,113,151,163,179,197,223,227,241,257,271,
%T 337,383,433,439,467,491,547,619,773,797,853,883,887,911,967,977,1069,
%U 1129,1187,1223,1291,1297,1409,1483,1489,1523,1559,1567,1579,1607,1619
%N a(1)=2, a(2)=3; a(n) for n>2 is the first prime > a(n-1) such that the concatenation of a(n-1), a(n-2) and a(n) is also prime.
%e E.g. a(3) is the smallest prime > a(2)=3 which, when concatenated to 23 (which is the concatenation of a(1) and a(2)) gives a prime. Thus a(3)=11 because 235 and 237 are composite.
%p with(numtheory): pout := [2,3]: nout := [1,2]: for n from 3 to 1000 do: p := ithprime(n): d := parse(cat(pout[nops(pout)-1],pout[nops(pout)],p)): if (isprime(d)) then pout := [op(pout),p]: nout := [op(nout),n]: fi: od: pout;
%t a[1] = 2; a[2] = 3; a[n_] := a[n] = SelectFirst[Prime@ Range[#, 10^3 + #] &[PrimePi@ a[n - 1] + 1], PrimeQ@ FromDigits@ Join[IntegerDigits@ a[n - 2], IntegerDigits@ a[n - 1], IntegerDigits@ #] &]; Array[a, 51] (* Version 10, or *)
%t a[1] = 2; a[2] = 3; a[n_] := a[n] = Block[{p = PrimePi@ a[n - 1] + 1},
%t While[! PrimeQ@ FromDigits@ Join[IntegerDigits@ a[n - 2], IntegerDigits@ a[n - 1], IntegerDigits@ p], p = NextPrime@ p]; p]; Array[a, 51] (* _Michael De Vlieger_, Aug 15 2016 *)
%Y Cf. A073640.
%K nonn,base
%O 1,1
%A Mark Hudson (mrmarkhudson(AT)hotmail.com), Jan 31 2003
%E Edited by _Charles R Greathouse IV_, Apr 26 2010
%E Edited by _Zak Seidov_, Aug 15 2016