Left-Truncatable Prime using Python

Introduction:

Prime numbers are a fundamental mathematical notion with several applications in cryptography, computer science, and number theory. A curious subset of prime numbers, left-truncatable primes, have unique qualities that make them an intriguing topic for study. We will look at left-truncatable primes in this article, describe their properties, and present a Python implementation to produce and test them.

Prime Numbers:

Natural numbers higher than one are considered prime numbers if they have only themselves and the number one as divisors. Prime numbers that are well-known include 2, 3, 5, 7, and 11. Because of their importance in different mathematical and computer disciplines, prime numbers have attracted mathematicians for ages.

Truncatable Primes:

Truncatable primes are prime numbers that are still thought of as prime even after gradually losing part of the digits on either their left or right side. Truncatable primes fall into two categories: left-truncatable primes and right-truncatable primes. We shall concentrate on left-truncatable primes in this essay.

A left-truncatable prime is a prime number that remains prime after repeatedly removing digits from its left side until just a single-digit prime remains. Because 317, 17, and 7 are all prime numbers, the number 317 is a left-truncatable prime. 123, on the other hand, is not a left-truncatable prime because 123 and 23 are prime but 3 is not.

Features of Left-Truncatable Primes:

  • Starting Digit: A left-truncatable prime must begin with a prime digit (2, 3, 5, or 7). This is because it cannot be prime if it begins with an even digit (other than 2 or 5).
  • Consecutive Primes: All numbers obtained by removing digits from the left side must be primes. This feature is maintained until a single-digit prime number (2, 3, 5, or 7) is attained.
  • Finite Set: Because the procedure eventually leads to a single-digit prime, and there are only four single-digit primes, there is a finite set of left-truncatable primes.

Python Programming:

We can write a Python program to generate and verify left-truncatable primes. A Python script is provided below that generates left-truncatable primes within a given range:

Output:

[2, 3, 5, 7, 13, 17, 23, 37, 43, 47, 53, 67, 73, 83, 97, 103, 107, 113, 137, 167, 173, 197, 223, 283, 307, 313, 317, 337, 347, 353, 367, 373, 383, 397, 443, 467, 503, 523, 547, 607, 613, 617, 643, 647, 653, 673, 683, 743, 773, 797, 823, 853, 883, 907, 937, 947, 953, 967, 983, 997, 1013, 1097, 1103, 1223, 1283, 1307, 1367, 1373, 1523, 1607, 1613, 1823, 1907, 1997, 2003, 2017, 2053, 2083, 2113, 2137, 2347, 2383, 2467, 2503, 2617, 2647, 2683, 2797, 2953, 3023, 3037, 3067, 3083, 3137, 3167, 3307, 3313, 3347, 3373, 3467, 3547, 3607, 3613, 3617, 3643, 3673, 3797, 3823, 3853, 3907, 3947, 3967, 4003, 4007, 4013, 4073, 4283, 4337, 4373, 4397, 4523, 4547, 4643, 4673, 4937, 4967]

Applications:

  • Number Theory Research: In number theory research, left-truncatable primes can be utilized as test cases or instances. Python may be used to generate and analyze these primes in order to learn more about prime number features and distributions.
  • Cryptography: Prime numbers are crucial in cryptography, even though they are not directly used in cryptographic techniques. As a subset of primes, left-truncatable primes can be utilized in instructional contexts to demonstrate prime number ideas and help students comprehend the significance of primes in cryptography.
  • Puzzles and Games: Left-truncatable primes can be utilized to create mathematical puzzles or games. Python can be used to create puzzles in which players or students must locate left-truncatable primes, which can be a fun method to practice arithmetic abilities.
  • Prime Factorization Testing: While left-truncatable primes are not utilized for factorization, we may use Python to construct left-truncatable integers and then test their factorization using various algorithms. This can be a useful exercise in learning about the security of prime-based encryption methods.

Conclusion:

Left-truncatable primes are an intriguing subset of prime numbers with distinct features. They require a prime initial digit and preserve their primality as digits are removed from the left side sequentially. As illustrated in the accompanying code, Python provides a strong tool for creating and testing left-truncatable primes. Exploring such mathematical topics not only broadens our understanding of numbers but also displays the beauty and elegance of prime numbers in mathematics.