login
a(0)=113, then a(n) = smallest prime p not already used such that the first three digits of p = the last three digits of a(n-1).
1

%I #6 Oct 19 2013 06:36:21

%S 113,11311,311,3119,1193,193,1931,9311,31121,1213,2131,131,1319,3191,

%T 191,1913,9133,13309,30911,911,91121,1217,2179,179,17903,90313,313,

%U 3137,137,1373,373,3733,733,7331,331,3313,31307,307,30703,70309,30931,9319

%N a(0)=113, then a(n) = smallest prime p not already used such that the first three digits of p = the last three digits of a(n-1).

%C Second-to-last (= third from right) digit of p is not allowed to be zero: e.g., after a(37)=307 we do not use 3079 because then next term must start with 079 which is not possible, hence a(38)=30703.

%H Zak Seidov, <a href="/A175687/b175687.txt">Table of n,a(n) for n=0..1000</a>

%t s={113};id2={1,1,3};Do[Do[p=Prime[k];If[FreeQ[s,p],idp=IntegerDigits[p];

%t If[id2==Take[idp,3]&&idp[[ -3]]>0,AppendTo[s,p];id2=Take[idp,-3];Break[]]],{k,31,10^7}],{1000}];s

%Y Cf. A175684.

%K base,nonn

%O 0,1

%A _Zak Seidov_, Aug 09 2010