cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A082756 Larger of a pair of consecutive primes having only prime digits.

This page as a plain text file.
%I A082756 #16 Mar 11 2022 13:01:17
%S A082756 3,5,7,227,733,3257,3733,5237,5333,7577,7727,7757,22277,23333,25537,
%T A082756 27737,32237,32327,32537,35327,35537,37273,37277,52237,52733,53327,
%U A082756 53353,53777,55337,72227,72733,75227,75533,75557,222533,222553,222557,223277,223757,225227
%N A082756 Larger of a pair of consecutive primes having only prime digits.
%H A082756 Michael S. Branicky, <a href="/A082756/b082756.txt">Table of n, a(n) for n = 1..10000</a>
%e A082756 227 is a term as the previous prime 223 also has only prime digits.
%t A082756 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 A082756 Transpose[Select[Partition[Prime[Range[20000]],2,1],And@@PrimeQ[ Flatten[ IntegerDigits/@#]]&]] [[2]] (* _Harvey P. Dale_, Jul 19 2011 *)
%o A082756 (Python)
%o A082756 from sympy import nextprime, isprime
%o A082756 from itertools import count, islice, product
%o A082756 def onlypd(n): return set(str(n)) <= set("2357")
%o A082756 def agen():
%o A082756     yield from [3, 5, 7]
%o A082756     for digits in count(2):
%o A082756         for p in product("2357", repeat=digits-1):
%o A082756             for end in "37":
%o A082756                 t = int("".join(p) + end)
%o A082756                 if isprime(t):
%o A082756                     t2 = nextprime(t)
%o A082756                     if onlypd(t2):
%o A082756                         yield t2
%o A082756 print(list(islice(agen(), 40))) # _Michael S. Branicky_, Mar 11 2022
%Y A082756 Cf. A019546, A082755.
%K A082756 base,nonn
%O A082756 1,1
%A A082756 _Amarnath Murthy_, Apr 18 2003
%E A082756 Edited and extended by _Robert G. Wilson v_, Apr 22 2003
%E A082756 a(38) and beyond from _Michael S. Branicky_, Mar 11 2022