Skip to content

huonw/primal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

140650b · Sep 23, 2024
Jun 7, 2024
Feb 16, 2022
Jun 7, 2024
Sep 22, 2024
Aug 15, 2022
Jun 7, 2024
Jun 7, 2024
Jun 7, 2024
Sep 22, 2024
Jun 7, 2024
Jan 3, 2023
Jun 6, 2015
Jun 7, 2024
Aug 16, 2014
Aug 16, 2014
Feb 15, 2022

Repository files navigation

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