login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A082756
Larger of a pair of consecutive primes having only prime digits.
2
3, 5, 7, 227, 733, 3257, 3733, 5237, 5333, 7577, 7727, 7757, 22277, 23333, 25537, 27737, 32237, 32327, 32537, 35327, 35537, 37273, 37277, 52237, 52733, 53327, 53353, 53777, 55337, 72227, 72733, 75227, 75533, 75557, 222533, 222553, 222557, 223277, 223757, 225227
OFFSET
1,1
LINKS
EXAMPLE
227 is a term as the previous prime 223 also has only prime digits.
MATHEMATICA
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}]
Transpose[Select[Partition[Prime[Range[20000]], 2, 1], And@@PrimeQ[ Flatten[ IntegerDigits/@#]]&]] [[2]] (* Harvey P. Dale, Jul 19 2011 *)
PROG
(Python)
from sympy import nextprime, isprime
from itertools import count, islice, product
def onlypd(n): return set(str(n)) <= set("2357")
def agen():
yield from [3, 5, 7]
for digits in count(2):
for p in product("2357", repeat=digits-1):
for end in "37":
t = int("".join(p) + end)
if isprime(t):
t2 = nextprime(t)
if onlypd(t2):
yield t2
print(list(islice(agen(), 40))) # Michael S. Branicky, Mar 11 2022
CROSSREFS
Sequence in context: A088092 A174271 A211678 * A268693 A068832 A046472
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Apr 18 2003
EXTENSIONS
Edited and extended by Robert G. Wilson v, Apr 22 2003
a(38) and beyond from Michael S. Branicky, Mar 11 2022
STATUS
approved