Crate prime_number_utils
source ·Expand description
prime-number-utils
‘prime-number-utils’ is a collection of utilities to generate prime numbers and to determine whether a number is prime efficiently.
Examples
use prime_number_utils::{GenPrime, SieveOfEratosthenes, baillie_psw};
let mut sieve_of_eratosthenes = SieveOfEratosthenes::new();
let mut primes = sieve_of_eratosthenes.gen_range(0..20);
assert_eq!(&primes, &vec![2, 3, 5, 7, 11, 13, 17, 19]);
assert!(primes.iter().all(|&n| baillie_psw(n)));
Re-exports
pub use crate::bigint::*;
Modules
Structs
- Generates prime numbers using bitwise.
- Implementation of the Linear Sieve.
- Implementation of the Segmented sieve.
- Implementation of the Sieve of Atkin.
- Implementation of the Sieve of Eratosthenes.
- Implementation of the Sieve of Sundaram.
Traits
Functions
- Implementation of Baillie-PSW, a probabilistic primality testing algorithm, using Montgomery modular multiplication.