Skip to main content

exclusive_factor

Function exclusive_factor 

Source
pub fn exclusive_factor<T: PrimInt + Unsigned + Roots>(n: T) -> Vec<T>
Expand description

For all unsigned integer inputs, returns all factors of the number, excluding one and the number itself.

ยงExamples

assert_eq!(fast_factor::exclusive_factor(0_u32), vec![]);
assert_eq!(fast_factor::exclusive_factor(1_u32), vec![]);
assert_eq!(fast_factor::exclusive_factor(7_u32), vec![]);
assert_eq!(fast_factor::exclusive_factor(12_u32), vec![2,3,4,6]);
assert_eq!(fast_factor::exclusive_factor(36_u32), vec![2,3,4,6,9,12,18]);