#math #mathematics #primes #number-theory

primal-bit

Bit-vector specialised to the prime-number-related needs of primal

6 releases

0.3.0 Jun 18, 2020
0.2.4 Aug 22, 2017
0.2.3 Aug 12, 2015
0.2.2 Jun 9, 2015

#3 in #number-theory

Download history 435/week @ 2021-04-04 883/week @ 2021-04-11 568/week @ 2021-04-18 659/week @ 2021-04-25 737/week @ 2021-05-02 737/week @ 2021-05-09 663/week @ 2021-05-16 1046/week @ 2021-05-23 965/week @ 2021-05-30 824/week @ 2021-06-06 986/week @ 2021-06-13 1027/week @ 2021-06-20 916/week @ 2021-06-27 960/week @ 2021-07-04 1331/week @ 2021-07-11 1057/week @ 2021-07-18

2,949 downloads per month
Used in 45 crates (2 directly)

MIT/Apache

19KB
478 lines

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

~18KB