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.

A215420 Primes that remain prime when a single digit 7 is inserted between any two consecutive digits or as the leading or trailing digit.

This page as a plain text file.
%I A215420 #20 Jul 23 2023 01:52:16
%S A215420 3,19,97,433,487,541,691,757,853,1471,2617,2953,4507,6481,7351,7417,
%T A215420 8317,13177,31957,42457,46477,47977,50077,59053,71917,73897,74377,
%U A215420 77479,77743,77761,79039,99103,175687,220897,271177,360973
%N A215420 Primes that remain prime when a single digit 7 is inserted between any two consecutive digits or as the leading or trailing digit.
%H A215420 Harvey P. Dale, <a href="/A215420/b215420.txt">Table of n, a(n) for n = 1..63</a> (all terms up to and including the 1 millionth prime)
%e A215420 59053 is prime as are 590537, 590573, 590753, 597053, 579053, and 759053.
%p A215420 A215420:=proc(q,x)
%p A215420 local a,b,c,d,i,n,ok;
%p A215420 for n from 1 to q do
%p A215420   a:=ithprime(n); b:=0; while a>0 do b:=b+1; a:=trunc(a/10); od;
%p A215420   a:=ithprime(n); ok:=1;
%p A215420   for i from 0 to b do
%p A215420     c:=a+9*10^i*trunc(a/10^i)+10^i*x; if not isprime(c) then ok:=0; break; fi;
%p A215420   od;
%p A215420   if ok=1 then print(ithprime(n)); fi;
%p A215420 od; end:
%p A215420 A215420(1000,7);
%t A215420 Select[Prime[Range[31000]],AllTrue[FromDigits/@Table[Insert[ IntegerDigits[ #],7,n],{n,IntegerLength[#]+1}],PrimeQ]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Oct 29 2020 *)
%Y A215420 Cf. A215417, A215418, A215419, A215421.
%K A215420 nonn,base
%O A215420 1,1
%A A215420 _Paolo P. Lava_, Aug 10 2012