A215420 Primes that remain prime when a single digit 7 is inserted between any two consecutive digits or as the leading or trailing digit.
3, 19, 97, 433, 487, 541, 691, 757, 853, 1471, 2617, 2953, 4507, 6481, 7351, 7417, 8317, 13177, 31957, 42457, 46477, 47977, 50077, 59053, 71917, 73897, 74377, 77479, 77743, 77761, 79039, 99103, 175687, 220897, 271177, 360973
Offset: 1
Examples
59053 is prime as are 590537, 590573, 590753, 597053, 579053, and 759053.
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..63 (all terms up to and including the 1 millionth prime)
Programs
-
Maple
A215420:=proc(q,x) local a,b,c,d,i,n,ok; for n from 1 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 0 to b 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: A215420(1000,7);
-
Mathematica
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 *)