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.

A347864 Left- or right-truncatable primes, restricted to one consecutive zero.

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 23, 29, 31, 37, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97, 103, 107, 113, 131, 137, 139, 167, 173, 179, 197, 223, 229, 233, 239, 271, 283, 293, 307, 311, 313, 317, 331, 337, 347, 353, 359, 367, 373, 379, 383, 397, 431, 433, 439, 443, 467, 479, 503
Offset: 1

Views

Author

Timothy Smith, Jan 25 2022

Keywords

Comments

There are 16484138 primes in this list, in total. The largest one has 60 digits and there is only one of that length.

Crossrefs

Left- or right-truncatable primes, excluding all 0s: A137812.
The number of primes of length n following these rules: A346662.

Programs

  • Python
    from sympy import isprime
    route = set({})
    nums = [i*(10**j) for i in range(1, 10) for j in range(2)]
    def addnum(a):
        global route
        for j in nums:
            b = int("{}{}".format(a, j))
            if isprime(b):
                if b not in route:
                    route.add(b)
                    addnum(b)
        for j in nums:
            b = int("{}{}".format(j, a))
            if isprime(b):
                if b not in route:
                    route.add(b)
                    addnum(b)
    def run():
        for i in nums:
            if isprime(i):
                addnum(i)