login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A245878 Primes p such that p - d and p + d are also primes, where d is the smallest nonzero digit of p. 1

%I #8 Feb 26 2023 17:30:55

%S 67,607,6977,68897,69067,69997,79867,80677,88867,97967,609607,660067,

%T 669667,676987,678767,697687,707677,766867,777677,786697,866087,

%U 879667,880667,886987,899687,906707,909767,966997,990967,6069977,6096907,6097997,6678877

%N Primes p such that p - d and p + d are also primes, where d is the smallest nonzero digit of p.

%C Intersection of A245744 and A245745.

%C The smallest nonzero digit of a(n) is 6, and the least significant digit of a(n) is 7.

%e The prime 607 is in the sequence because 607 - 6 = 601 and 607 + 6 = 613 are both primes.

%t 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 *)

%o (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

%o (Python)

%o import sympy

%o from sympy import isprime

%o from sympy import prime

%o for n in range(1,10**6):

%o ..s=prime(n)

%o ..lst = []

%o ..for i in str(s):

%o ....if i != '0':

%o ......lst.append(int(i))

%o ..if isprime(s+min(lst)) and isprime(s-min(lst)):

%o ....print(s,end=', ')

%o # _Derek Orr_, Aug 13 2014

%Y Cf. A245742, A245743, A245744, A245745, A245877.

%K nonn,base

%O 1,1

%A _Colin Barker_, Aug 05 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 07:57 EDT 2024. Contains 371698 sequences. (Running on oeis4.)