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.

A007597 Strobogrammatic primes.

Original entry on oeis.org

11, 101, 181, 619, 16091, 18181, 19861, 61819, 116911, 119611, 160091, 169691, 191161, 196961, 686989, 688889, 1008001, 1068901, 1160911, 1180811, 1190611, 1191611, 1681891, 1690691, 1880881, 1881881, 1898681, 1908061, 1960961, 1990661, 6081809, 6100019, 6108019
Offset: 1

Views

Author

Keywords

Comments

Primes which are invariant under a 180-degree rotation.

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • C. W. Trigg, "Strobogrammatic Primes and Prime Rotative Twins", J. Rec. Math., 15 (1983), 281-282.

Crossrefs

Cf. A000787.

Programs

  • Mathematica
    lst = {}; fQ[n_] := Block[{allset = {0, 1, 6, 8, 9}, id = IntegerDigits@n}, Union@ Join[id, allset] == allset && Reverse[id /. {6 -> 9, 9 -> 6}] == id]; Do[ If[ PrimeQ@n && fQ@n, AppendTo[lst, n]], {n, 2000000}]; lst (* Robert G. Wilson v, Feb 27 2007 *)
  • Python
    from sympy import isprime
    from itertools import count, islice, product
    def ud(s): return s[::-1].translate({ord('6'):ord('9'), ord('9'):ord('6')})
    def agen():
        for d in count(2):
            for start in "1689":
                for rest in product("01689", repeat=d//2-1):
                    left = start + "".join(rest)
                    right = ud(left)
                    for mid in [[""], ["0", "1", "8"]][d%2]:
                        t = int(left + mid + right)
                        if isprime(t):
                            yield t
    print(list(islice(agen(), 33))) # Michael S. Branicky, Mar 29 2022

Extensions

More terms from David W. Wilson
a(31)-a(33) from K. D. Bajpai, Jun 23 2017