[go: up one dir, main page]

login
A217046
Primes that remain prime when a single "6" digit is inserted between any two adjacent decimal digits.
4
13, 17, 23, 29, 37, 41, 43, 47, 53, 59, 61, 71, 79, 83, 97, 101, 109, 113, 137, 157, 163, 167, 263, 277, 293, 307, 313, 317, 331, 397, 421, 443, 457, 463, 569, 607, 653, 659, 661, 673, 691, 739, 769, 787, 809, 823, 829, 863, 881, 977, 997, 1063, 1087, 1453
OFFSET
1,1
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..500 (First 262 terms from Paolo P. Lava)
EXAMPLE
185917 is prime and also 1859167, 1859617, 1856917, 1865917 and 1685917.
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, 6)
MATHEMATICA
Select[Prime[Range[5, 1200]], And@@PrimeQ[FromDigits/@Table[ Insert[ IntegerDigits[ #], 6, i], {i, 2, IntegerLength[#]}]]&] (* Harvey P. Dale, Oct 09 2012 *)
PROG
(PARI) is(n)=my(v=concat([""], digits(n))); for(i=2, #v-1, v[1]=Str(v[1], v[i]); v[i]=6; 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 25 2012
STATUS
approved