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.

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

This page as a plain text file.
%I A217045 #14 Dec 04 2017 19:11:34
%S A217045 19,37,43,61,67,73,97,109,199,211,223,241,349,409,421,457,463,541,571,
%T A217045 751,757,823,991,1033,1087,1321,1423,1447,1543,2749,3361,3469,3499,
%U A217045 3847,4111,4273,4483,5059,5437,5443,5449,6373,6709,6793,7687,8089,8221,8443
%N A217045 Primes that remain prime when a single "4" digit is inserted between any two adjacent decimal digits.
%H A217045 Paolo P. Lava, <a href="/A217045/b217045.txt">Table of n, a(n) for n = 1..141</a>
%e A217045 87697 is prime and also 876947, 876497, 874697 and 847697.
%p A217045 with(numtheory);
%p A217045 A217045:=proc(q,x)
%p A217045 local a,b,c,i,n,ok;
%p A217045 for n from 5 to q do
%p A217045 a:=ithprime(n); b:=0;
%p A217045 while a>0 do b:=b+1; a:=trunc(a/10); od; a:=ithprime(n); ok:=1;
%p A217045   for i from 1 to b-1 do
%p A217045     c:=a+9*10^i*trunc(a/10^i)+10^i*x;
%p A217045     if not isprime(c) then ok:=0; break; fi; od;
%p A217045   if ok=1 then print(ithprime(n)); fi;
%p A217045 od; end:
%p A217045 A217045(100000,4)
%t A217045 Select[Prime[Range[5,1500]],AllTrue[Table[FromDigits[Insert[ IntegerDigits[ #],4,n]],{n,2,IntegerLength[#]}],PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Dec 04 2017 *)
%o A217045 (PARI) is(n)=my(v=concat([""], digits(n))); for(i=2, #v-1, v[1]=Str(v[1], v[i]); v[i]=4; if(i>2, v[i-1]=""); if(!isprime(eval(concat(v))), return(0))); isprime(n) \\ _Charles R Greathouse IV_, Sep 26 2012
%Y A217045 Cf. A050674, A050711-A050719, A069246, A159236, A215417, A215419-A215421, A217044, A217046, A217047, A217062-A217065
%K A217045 nonn,base
%O A217045 1,1
%A A217045 _Paolo P. Lava_, Sep 25 2012