Hasty Briefsbeta

Bilingual

Right-Truncatable Prime Counter

a year ago
  • #prime numbers
  • #mathematics
  • #C programming
  • The C program calculates right-truncatable primes efficiently.
  • Uses a custom hash table for fast primality lookups and the primesieve library for prime generation.
  • A right-truncatable prime remains prime when its rightmost digit is successively removed (e.g., 739).
  • There are 83 right-truncatable primes, with the largest being 73939133 (8-digit).
  • Primes above 5 end with digits 1, 3, 7, or 9.
  • Features include efficient prime generation, fast primality testing, and flexible digit count handling.
  • Requires a C99 compiler, primesieve library, CMake, and Homebrew (macOS).
  • Setup and compilation can be automated using the provided setup.sh script.
  • Example usage: ./count_primes.out 8 to find 8-digit right-truncatable primes.
  • Output includes prime counts, execution time, and total right-truncatable primes.
  • Valid input range: 1 to 19 digits.
  • Licensed under the MIT License.