login
A245878
Primes p such that p - d and p + d are also primes, where d is the smallest nonzero digit of p.
2
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.
LINKS
EXAMPLE
The prime 607 is in the sequence because 607 - 6 = 601 and 607 + 6 = 613 are both primes.
MAPLE
f:= proc(x) local L, i, y;
L:= subs(1=6, 2=7, 3=8, 4=9, convert(x, base, 5));
if not member(6, L) then return NULL fi;
y:= add(L[i]*10^(i-1), i=1..nops(L));
if isprime(y) and isprime(y-6) and isprime(y+6) then y else NULL fi
end proc:
map(f, [seq(2+5*k, k=1..10000)]); # Robert Israel, Nov 25 2024
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)
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,look
AUTHOR
Colin Barker, Aug 05 2014
STATUS
approved