A346662 Number of n-digit left- or right-truncatable primes with no consecutive zero digits.
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
Examples
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
Links
- Wikipedia, Truncatable prime
Crossrefs
Programs
-
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()
Comments