OFFSET
1,1
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..100
EXAMPLE
31387 is prime and also 313879, 313897, 313987, 319387, 391387, 931387.
MAPLE
A215421:=proc(q, x)
local a, b, c, d, i, n, ok;
for n from 1 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 0 to b 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:
A215421(1000, 9);
MATHEMATICA
Select[Prime[Range[30000]], AllTrue[FromDigits/@Table[Insert[ IntegerDigits[ #], 9, n], {n, IntegerLength[ #]+1}], PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Oct 22 2016 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Paolo P. Lava, Aug 10 2012
STATUS
approved