login
A050987
Number of n-digit left-truncatable primes.
18
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,1
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
PROG
(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
KEYWORD
base,nonn,easy,fini,full
EXTENSIONS
Edited by Ray Chandler, Mar 13 2007
a(25) = 0 added by M. F. Hasler, Nov 07 2018
STATUS
approved