#prime #number-theory

primal-check

Fast standalone primality testing

9 releases

0.3.4 Jun 7, 2024
0.3.3 Sep 16, 2022
0.3.2 Aug 15, 2022
0.3.1 Jun 18, 2020
0.2.1 Jun 8, 2015

#688 in Math

Download history 53274/week @ 2024-12-14 27653/week @ 2024-12-21 36706/week @ 2024-12-28 45448/week @ 2025-01-04 47368/week @ 2025-01-11 48687/week @ 2025-01-18 52711/week @ 2025-01-25 52609/week @ 2025-02-01 142870/week @ 2025-02-08 136306/week @ 2025-02-15 161305/week @ 2025-02-22 181270/week @ 2025-03-01 157319/week @ 2025-03-08 144802/week @ 2025-03-15 139283/week @ 2025-03-22 114344/week @ 2025-03-29

584,353 downloads per month
Used in 427 crates (4 directly)

MIT/Apache

12KB
219 lines

primal

crates.io documentation minimum rustc 1.36

primal puts raw power into prime numbers.

This crates includes

  • optimised prime sieves
  • checking for primality
  • enumerating primes
  • factorising numbers
  • estimating upper and lower bounds for π(n) (the number of primes below n) and pk (the kth prime)

This uses a state-of-the-art cache-friendly Sieve of Eratosthenes to enumerate the primes up to some fixed bound (in a memory efficient manner), and then allows this cached information to be used for things like enumerating and counting primes.

primal takes around 2.8 seconds and less than 3MB of RAM to count the exact number of primes below 1010 (455052511) on the author's laptop (i7-3517U).

Documentation

Dependencies

~200KB