cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A217044 #29 Apr 25 2025 10:48:37
%S A217044 17,23,29,41,53,83,89,101,113,131,137,149,251,359,401,419,443,461,647,
%T A217044 719,797,821,863,941,1289,1823,2111,2543,3323,3413,4013,4463,4751,
%U A217044 5021,5501,5807,6299,6827,7229,7643,7883,8039,8219,8609,8837,9221,9227,9461,9623
%N A217044 Primes that remain prime when a single "2" digit is inserted between any two adjacent decimal digits.
%H A217044 Bruno Berselli, <a href="/A217044/b217044.txt">Table of n, a(n) for n = 1..500</a> (first 123 terms from Paolo Lava)
%e A217044 9461 is prime and also 94621, 94261, 92461.
%p A217044 with(numtheory);
%p A217044 A217044:=proc(q,x)
%p A217044 local a,b,c,i,n,ok;
%p A217044 for n from 5 to q do
%p A217044 a:=ithprime(n); b:=0;
%p A217044 while a>0 do b:=b+1; a:=trunc(a/10); od; a:=ithprime(n); ok:=1;
%p A217044   for i from 1 to b-1 do
%p A217044     c:=a+9*10^i*trunc(a/10^i)+10^i*x;
%p A217044     if not isprime(c) then ok:=0; break; fi; od;
%p A217044   if ok=1 then print(ithprime(n)); fi;
%p A217044 od; end:
%p A217044 A217044(100000,2)
%t A217044 Select[Prime[Range[5,1200]],And@@PrimeQ[FromDigits/@Table[ Insert[ IntegerDigits[ #],2,i],{i,2,IntegerLength[#]}]]&] (* _Harvey P. Dale_, Oct 09 2012 *)
%o A217044 (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 A217044 (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 A217044 Cf. A050674, A050711-A050719, A069246, A159236, A215417, A215419-A215421, A217045-A217047, A217062-A217065.
%K A217044 nonn,base
%O A217044 1,1
%A A217044 _Paolo P. Lava_, Sep 25 2012