8 releases

0.3.3 Sep 16, 2022
0.3.2 Aug 15, 2022
0.3.1 Jun 18, 2020
0.2.3 Jan 4, 2018
0.2.1 Jun 8, 2015

#332 in Math

Download history 20250/week @ 2023-10-19 19700/week @ 2023-10-26 20563/week @ 2023-11-02 20276/week @ 2023-11-09 21309/week @ 2023-11-16 20079/week @ 2023-11-23 21531/week @ 2023-11-30 22310/week @ 2023-12-07 19388/week @ 2023-12-14 12224/week @ 2023-12-21 14854/week @ 2023-12-28 16540/week @ 2024-01-04 20876/week @ 2024-01-11 23891/week @ 2024-01-18 25490/week @ 2024-01-25 23379/week @ 2024-02-01

96,649 downloads per month
Used in 296 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

~210KB