12 releases

0.3.1 Jun 18, 2020
0.3.0 Jun 18, 2020
0.2.9 Jun 23, 2018
0.2.8 Nov 23, 2017
0.2.4 Jun 30, 2015

#87 in Math

Download history 720/week @ 2021-01-16 581/week @ 2021-01-23 769/week @ 2021-01-30 642/week @ 2021-02-06 655/week @ 2021-02-13 853/week @ 2021-02-20 845/week @ 2021-02-27 804/week @ 2021-03-06 607/week @ 2021-03-13 708/week @ 2021-03-20 641/week @ 2021-03-27 456/week @ 2021-04-03 905/week @ 2021-04-10 617/week @ 2021-04-17 711/week @ 2021-04-24 766/week @ 2021-05-01

2,677 downloads per month
Used in 43 crates (3 directly)

MIT/Apache

495KB
7.5K SLoC

primal

Build Status codecov crates.io

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

~94KB