login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A346662
Number of n-digit left- or right-truncatable primes with no consecutive zero digits.
1
4, 16, 76, 300, 955, 2648, 6402, 14339, 28684, 53450, 91284, 147064, 221301, 319067, 433227, 567565, 700765, 834464, 947055, 1050886, 1114368, 1157526, 1150645, 1117265, 1044757, 963722, 855804, 753172, 633786, 528122, 426328, 339866, 264078, 202013, 150330, 111055, 78996, 56123, 38874, 26644, 17944, 11898, 7878, 4945, 3255, 2024, 1323, 764, 464, 286, 158, 77, 40, 26, 14, 5, 5, 4, 1, 1
OFFSET
1,1
COMMENTS
A left- or right-truncatable prime is a prime number from which one digit at a time may be removed from the left or right end until a single-digit prime is reached, with each digit removal resulting in a prime. There exists only one such 60-digit prime: 202075909708030901050930450609080660821035604908735717137397. Since it cannot be extended, there are no such primes with more than 60 digits, so a(60)=1 is the final term of the sequence.
EXAMPLE
The 16 two-digit left- or right-truncatable primes with no consecutive zero digits are 13, 17, 23, 29, 31, 37, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97.
The first 10 three-digit left- or right-truncatable primes with no consecutive zero digits are 103, 107, 113, 131, 137, 139, 167, 173, 179, 197.
The unique 60-digit left- or right-truncatable prime with no consecutive zero digits can be sequentially truncated to a single-digit prime as follows, where each "..." indicates repeated removal of the leftmost digit:
202075909708030901050930450609080660821035604908735717137397
...
2075909708030901050930450609080660821035604908735717137397
207590970803090105093045060908066082103560490873571713739
...
970803090105093045060908066082103560490873571713739
97080309010509304506090806608210356049087357171373
...
6090806608210356049087357171373
609080660821035604908735717137
...
80660821035604908735717137
8066082103560490873571713
806608210356049087357171
...
8210356049087357171
821035604908735717
21035604908735717
2103560490873571
...
71
7
PROG
(Python)
from sympy import isprime
dumps = set({})
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)
run()
CROSSREFS
Left- or right-truncatable primes, excluding all 0s: A137812.
Left- or right-truncatable primes with 0s allowed, but none consecutive: A347864.
Sequence in context: A324171 A204772 A050540 * A094559 A199214 A374566
KEYWORD
nonn,fini,full
AUTHOR
Timothy Smith, Jan 25 2022
STATUS
approved