login
A245878
Primes p such that p - d and p + d are also primes, where d is the smallest nonzero digit of p.
1
67, 607, 6977, 68897, 69067, 69997, 79867, 80677, 88867, 97967, 609607, 660067, 669667, 676987, 678767, 697687, 707677, 766867, 777677, 786697, 866087, 879667, 880667, 886987, 899687, 906707, 909767, 966997, 990967, 6069977, 6096907, 6097997, 6678877
OFFSET
1,1
COMMENTS
Intersection of A245744 and A245745.
The smallest nonzero digit of a(n) is 6, and the least significant digit of a(n) is 7.
EXAMPLE
The prime 607 is in the sequence because 607 - 6 = 601 and 607 + 6 = 613 are both primes.
MATHEMATICA
pdQ[p_]:=Module[{c=Min[DeleteCases[IntegerDigits[p], 0]]}, AllTrue[p+{c, -c}, PrimeQ]]; Select[Prime[Range[460000]], pdQ] (* Harvey P. Dale, Feb 26 2023 *)
PROG
(PARI) s=[]; forprime(p=2, 7000000, v=vecsort(digits(p), , 8); d=v[1+!v[1]]; if(isprime(p-d) && isprime(p+d), s=concat(s, p))); s
(Python)
import sympy
from sympy import isprime
from sympy import prime
for n in range(1, 10**6):
..s=prime(n)
..lst = []
..for i in str(s):
....if i != '0':
......lst.append(int(i))
..if isprime(s+min(lst)) and isprime(s-min(lst)):
....print(s, end=', ')
# Derek Orr, Aug 13 2014
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Colin Barker, Aug 05 2014
STATUS
approved