#prime #number-theory #lower-bounds

primal-estimate

State-of-the-art estimation of upper and lower bounds for π(n) (the number of primes below n) and p_k (the k-th prime)

5 releases

0.3.2 Aug 15, 2022
0.3.1 Jun 18, 2020
0.3.0 Jun 18, 2020
0.2.1 Jun 8, 2015
0.2.0 Jun 6, 2015

#5 in #lower-bounds

Download history 2082/week @ 2023-12-14 1086/week @ 2023-12-21 821/week @ 2023-12-28 1720/week @ 2024-01-04 2352/week @ 2024-01-11 1991/week @ 2024-01-18 2596/week @ 2024-01-25 2504/week @ 2024-02-01 3054/week @ 2024-02-08 3342/week @ 2024-02-15 4189/week @ 2024-02-22 4233/week @ 2024-02-29 4472/week @ 2024-03-07 3390/week @ 2024-03-14 2988/week @ 2024-03-21 2392/week @ 2024-03-28

13,793 downloads per month
Used in 75 crates (3 directly)

MIT/Apache

21KB
251 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:

Estimate upper and lower bounds for the n-th prime, and π(n), the number of primes less than or equal to n.

This is designed to be used via the primal crate.

No runtime deps