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.

A082755 Smaller of a pair of consecutive primes having only prime digits.

Original entry on oeis.org

2, 3, 5, 223, 727, 3253, 3727, 5233, 5323, 7573, 7723, 7753, 22273, 23327, 25523, 27733, 32233, 32323, 32533, 35323, 35533, 37253, 37273, 52223, 52727, 53323, 53327, 53773, 55333, 72223, 72727, 75223, 75527, 75553, 222527, 222533, 222553, 223273, 223753, 225223
Offset: 1

Views

Author

Amarnath Murthy, Apr 18 2003

Keywords

Examples

			223 is a term as the next prime 227 also has only prime digits.
		

Crossrefs

Programs

  • 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[p]], {n, 1, 20000}]
    Prime[#]&/@SequencePosition[Table[If[AllTrue[IntegerDigits[n],PrimeQ],1,0],{n,Prime[Range[20000]]}],{1,1}][[All,1]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 31 2017 *)
  • 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 [2, 3, 5]
        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) and onlypd(nextprime(t)):
                        yield t
    print(list(islice(agen(), 40))) # Michael S. Branicky, Mar 11 2022

Extensions

Edited and extended by Robert G. Wilson v, Apr 22 2003