Crate prime_number_utils

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§

bigint

Structs§

BitwiseSieve
Generates prime numbers using bitwise.
LinearSieve
Implementation of the Linear Sieve.
SegmentedSieve
Implementation of the Segmented sieve.
SieveOfAtkin
Implementation of the Sieve of Atkin.
SieveOfEratosthenes
Implementation of the Sieve of Eratosthenes.
SieveOfSundaram
Implementation of the Sieve of Sundaram.

Traits§

GenPrime

Functions§

baillie_psw
Implementation of Baillie-PSW, a probabilistic primality testing algorithm, using Montgomery modular multiplication.