Expand description
smcPrime - Ultra-fast primality testing
Deterministic primality testing for 32-bit and 64-bit integers using Montgomery arithmetic and optimal Miller-Rabin witnesses.
§Example
use smcprime::{is_prime, is_prime32, is_prime64, next_prime, prev_prime};
assert!(is_prime(17));
assert!(!is_prime(18));
assert_eq!(next_prime(100), 101);
assert_eq!(prev_prime(100), 97);Functions§
- is_
prime - Primality test (defaults to 64-bit)
- is_
prime32 - Deterministic primality test for 32-bit integers
- is_
prime64 - Deterministic primality test for 64-bit integers
- next_
prime - Find next prime (defaults to 64-bit)
- next_
prime32 - Find the next prime >= n (32-bit)
- next_
prime64 - Find the next prime >= n (64-bit)
- prev_
prime - Find previous prime (defaults to 64-bit)
- prev_
prime32 - Find the previous prime <= n (32-bit)
- prev_
prime64 - Find the previous prime <= n (64-bit)