#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

#94 in Math

Download history 32071/week @ 2024-08-15 41310/week @ 2024-08-22 37192/week @ 2024-08-29 40127/week @ 2024-09-05 40765/week @ 2024-09-12 41497/week @ 2024-09-19 42392/week @ 2024-09-26 46988/week @ 2024-10-03 54084/week @ 2024-10-10 53072/week @ 2024-10-17 54032/week @ 2024-10-24 53767/week @ 2024-10-31 45796/week @ 2024-11-07 46546/week @ 2024-11-14 52918/week @ 2024-11-21 45057/week @ 2024-11-28

199,447 downloads per month
Used in 380 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


lib.rs:

Check some primality-related properties of numbers.

This crate is designed to be used via primal.

Dependencies

~205KB