login
A217062
Primes that remain prime when a single "9" digit is inserted between any two adjacent digits.
9
11, 13, 17, 19, 23, 37, 41, 53, 59, 61, 97, 101, 107, 113, 149, 193, 197, 199, 227, 239, 263, 269, 271, 311, 331, 367, 409, 431, 443, 457, 499, 587, 617, 659, 661, 691, 727, 733, 751, 823, 863, 941, 967, 1009, 1423, 1571, 1709, 1759, 1973, 1993, 1997, 2063, 2137
OFFSET
1,1
LINKS
EXAMPLE
214883 is prime and also 2148893, 2148983, 2149883, 2194883 and 2914883.
MAPLE
with(numtheory);
A217062:=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:
A217062(1000000, 9);
PROG
(PARI) is(n)=my(v=concat([""], digits(n))); for(i=2, #v-1, v[1]=Str(v[1], v[i]); v[i]=9; if(i>2, v[i-1]=""); if(!isprime(eval(concat(v))), return(0))); isprime(n) \\ Charles R Greathouse IV, Sep 26 2012
KEYWORD
nonn,base
AUTHOR
Paolo P. Lava, Sep 26 2012
STATUS
approved