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]);

Functions§

exclusive_factor
For all unsigned integer inputs, returns all factors of the number, excluding one and the number itself.
factor
For non-zero inputs, which must be unsigned integers, returns all factors of the number given, including one and the number itself, as a vector. Returns an empty vector for zero.
proper_factor
For all unsigned integer inputs, returns all factors of the number, excluding the number itself.