[−][src]Function reikna::factor::lcm_all
pub fn lcm_all(set: &[u64]) -> u64
Return the LCM of the set of integers
This function works by applying the fact that the LCM is both commutative and associative, and as such the LCM of a set can be found by computing the LCM of each of its members with a running LCM total.
If an empty set is given, 1
will be returned.
Examples
use reikna::factor::lcm_all; assert_eq!(lcm_all(&vec![8, 9, 21]), 504); assert_eq!(lcm_all(&vec![4, 7, 12, 21, 42]), 84);