login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A217044 Primes that remain prime when a single "2" digit is inserted between any two adjacent decimal digits. 9

%I #25 Sep 08 2022 08:46:04

%S 17,23,29,41,53,83,89,101,113,131,137,149,251,359,401,419,443,461,647,

%T 719,797,821,863,941,1289,1823,2111,2543,3323,3413,4013,4463,4751,

%U 5021,5501,5807,6299,6827,7229,7643,7883,8039,8219,8609,8837,9221,9227,9461,9623

%N Primes that remain prime when a single "2" digit is inserted between any two adjacent decimal digits.

%H Paolo P. Lava and Bruno Berselli, <a href="/A217044/b217044.txt">Table of n, a(n) for n = 1..500</a> (first 123 terms from Paolo Lava)

%e 9461 is prime and also 94621, 94261, 92461.

%p with(numtheory);

%p A217044:=proc(q,x)

%p local a,b,c,i,n,ok;

%p for n from 5 to q do

%p a:=ithprime(n); b:=0;

%p while a>0 do b:=b+1; a:=trunc(a/10); od; a:=ithprime(n); ok:=1;

%p for i from 1 to b-1 do

%p c:=a+9*10^i*trunc(a/10^i)+10^i*x;

%p if not isprime(c) then ok:=0; break; fi; od;

%p if ok=1 then print(ithprime(n)); fi;

%p od; end:

%p A217044(100000,2)

%t Select[Prime[Range[5,1200]],And@@PrimeQ[FromDigits/@Table[ Insert[ IntegerDigits[ #],2,i],{i,2,IntegerLength[#]}]]&] (* _Harvey P. Dale_, Oct 09 2012 *)

%o (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

%o (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

%Y Cf. A050674, A050711-A050719, A069246, A159236, A215417, A215419-A215421, A217045-A217047, A217062-A217065.

%K nonn,base

%O 1,1

%A _Paolo P. Lava_, Sep 25 2012

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 7 21:53 EDT 2024. Contains 372317 sequences. (Running on oeis4.)