1 unstable release
0.1.0 | Jan 7, 2024 |
---|
#1938 in Math
25KB
672 lines
Prime-number-utils
lib.rs
:
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)));
Dependencies
~485KB
~10K SLoC