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.

A050987 Number of n-digit left-truncatable primes.

Original entry on oeis.org

4, 11, 39, 99, 192, 326, 429, 521, 545, 517, 448, 354, 276, 212, 117, 72, 42, 24, 13, 6, 5, 4, 3, 1, 0
Offset: 1

Views

Author

Keywords

Comments

The sequence is well defined for any positive integer, with a(n) = 0 for n >= 25. But it makes sense to consider it to be full & finite. - M. F. Hasler, Nov 07 2018

Crossrefs

Programs

  • PARI
    A050987=vector(25, n, #p=concat(apply(p->select(isprime, vector(9, i, i*10^(n-1)+p)), if(n>1, p)))) \\ M. F. Hasler, Nov 07 2018
    
  • Python
    from sympy import isprime
    def alst():
      primes, alst = [2, 3, 5, 7], [4]
      while len(primes) > 0:
        candidates = set(int(d+str(p)) for p in primes for d in "123456789")
        primes = [c for c in candidates if isprime(c)]
        alst.append(len(primes))
      return alst
    print(alst()) # Michael S. Branicky, Apr 11 2021

Extensions

Edited by Ray Chandler, Mar 13 2007
a(25) = 0 added by M. F. Hasler, Nov 07 2018