A080153 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.
2, 3, 11, 23, 31, 41, 59, 79, 97, 107, 113, 151, 163, 179, 197, 223, 227, 241, 257, 271, 337, 383, 433, 439, 467, 491, 547, 619, 773, 797, 853, 883, 887, 911, 967, 977, 1069, 1129, 1187, 1223, 1291, 1297, 1409, 1483, 1489, 1523, 1559, 1567, 1579, 1607, 1619
Offset: 1
Examples
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.
Crossrefs
Cf. A073640.
Programs
-
Maple
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;
-
Mathematica
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 *) a[1] = 2; a[2] = 3; a[n_] := a[n] = Block[{p = PrimePi@ a[n - 1] + 1}, 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 *)
Extensions
Edited by Charles R Greathouse IV, Apr 26 2010
Edited by Zak Seidov, Aug 15 2016