Skip to main content

Crate fast_factor

Crate fast_factor 

Source
Expand description

A reasonably fast factorisation library for unsigned integers.

§Examples

assert_eq!(fast_factor::factor(24_u32), vec![1,2,3,4,6,8,12,24]);
assert_eq!(fast_factor::proper_factor(24_u32), vec![1,2,3,4,6,8,12]);
assert_eq!(fast_factor::exclusive_factor(24_u32), vec![2,3,4,6,8,12]);
assert!(!fast_factor::is_prime(24_u32));

Functions§

exclusive_factor
For all unsigned integer inputs, returns all factors of the number, excluding one and the number itself.
factor
For non-zero be unsigned integer inputs, returns all factors of the number given, including one and the number itself, as a vector. Returns an empty vector for zero.
is_prime
For all unsigned integer inputs, returns whether the number is prime. 0 and 1 are not.
proper_factor
For all unsigned integer inputs, returns all factors of the number, excluding the number itself.