Easy to use implementation of extended and normanl Euclidean algorithm
Program
rs use euc_lib; fn main() { prinln!("{:?}", euc_lib::euc_ext(135, 35)); }
OutputEucRes { d: 5, s: -1, t: 4 }
Simple
Program
rs use euc_lib; fn main() { prinln!("{}", euc_lib::euc(135, 35)); // there is recursive variant too: euc_recursive(135,35) }
Output5
Vector as an argument
Program
rs use euc_lib; fn main() { println!("{}", euc_lib::euc_from_vec(vec![21, 14, 56])); }
Output7
This version implements Least common multiple calculating method using gcd (Euclidean algorithm)
Program
rs use euc_lib; fn main () { println!("{:?}", euc_lib::lcm(21, 6)) // there is recursive variant too: lcm_recursive }
Output42