OFFSET
1,1
LINKS
Paolo P. Lava and Bruno Berselli, Table of n, a(n) for n = 1..500 (first 123 terms from Paolo Lava)
EXAMPLE
9461 is prime and also 94621, 94261, 92461.
MAPLE
with(numtheory);
A217044:=proc(q, x)
local a, b, c, i, n, ok;
for n from 5 to q do
a:=ithprime(n); b:=0;
while a>0 do b:=b+1; a:=trunc(a/10); od; a:=ithprime(n); ok:=1;
for i from 1 to b-1 do
c:=a+9*10^i*trunc(a/10^i)+10^i*x;
if not isprime(c) then ok:=0; break; fi; od;
if ok=1 then print(ithprime(n)); fi;
od; end:
A217044(100000, 2)
MATHEMATICA
Select[Prime[Range[5, 1200]], And@@PrimeQ[FromDigits/@Table[ Insert[ IntegerDigits[ #], 2, i], {i, 2, IntegerLength[#]}]]&] (* Harvey P. Dale, Oct 09 2012 *)
PROG
(Magma) [p: p in PrimesInInterval(11, 10000) | forall{m: t in [1..#Intseq(p)-1] | IsPrime(m) where m is (Floor(p/10^t)*10+2)*10^t+p mod 10^t}]; // Bruno Berselli, Sep 26 2012
(PARI) is(n)=my(v=concat([""], digits(n))); for(i=2, #v-1, v[1]=Str(v[1], v[i]); v[i]=2; if(i>2, v[i-1]=""); if(!isprime(eval(concat(v))), return(0))); isprime(n) \\ Charles R Greathouse IV, Sep 26 2012
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Paolo P. Lava, Sep 25 2012
STATUS
approved