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!)
A082756 Larger of a pair of consecutive primes having only prime digits. 2

%I #16 Mar 11 2022 13:01:17

%S 3,5,7,227,733,3257,3733,5237,5333,7577,7727,7757,22277,23333,25537,

%T 27737,32237,32327,32537,35327,35537,37273,37277,52237,52733,53327,

%U 53353,53777,55337,72227,72733,75227,75533,75557,222533,222553,222557,223277,223757,225227

%N Larger of a pair of consecutive primes having only prime digits.

%H Michael S. Branicky, <a href="/A082756/b082756.txt">Table of n, a(n) for n = 1..10000</a>

%e 227 is a term as the previous prime 223 also has only prime digits.

%t NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; p = 0; q = 1; pd = {1}; Do[p = q; pd = qd; q = NextPrim[p]; qd = Union[ Join[{2, 3, 5, 7}, IntegerDigits[q]]]; If[pd == qd == {2, 3, 5, 7}, Print[q]], {n, 1, 20000}]

%t Transpose[Select[Partition[Prime[Range[20000]],2,1],And@@PrimeQ[ Flatten[ IntegerDigits/@#]]&]] [[2]] (* _Harvey P. Dale_, Jul 19 2011 *)

%o (Python)

%o from sympy import nextprime, isprime

%o from itertools import count, islice, product

%o def onlypd(n): return set(str(n)) <= set("2357")

%o def agen():

%o yield from [3, 5, 7]

%o for digits in count(2):

%o for p in product("2357", repeat=digits-1):

%o for end in "37":

%o t = int("".join(p) + end)

%o if isprime(t):

%o t2 = nextprime(t)

%o if onlypd(t2):

%o yield t2

%o print(list(islice(agen(), 40))) # _Michael S. Branicky_, Mar 11 2022

%Y Cf. A019546, A082755.

%K base,nonn

%O 1,1

%A _Amarnath Murthy_, Apr 18 2003

%E Edited and extended by _Robert G. Wilson v_, Apr 22 2003

%E a(38) and beyond from _Michael S. Branicky_, Mar 11 2022

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 May 7 08:08 EDT 2024. Contains 372300 sequences. (Running on oeis4.)