euc_lib

Easy to use implementation of extended and normanl Euclidean algorithm

Want to contribute?:

My github:

github

Project:

github

Support:

https://www.buymeacoffee.com/WhiskyAKM



Example usage:

Extended

Program rs use euc_lib; fn main() { prinln!("{:?}", euc_lib::euc_ext(135, 35)); } Output EucRes { 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) } Output 5

Vector as an argument

Program rs use euc_lib; fn main() { println!("{:?}", euc_lib::euc_from_vec(vec![21, 14, 56])); } Output Ok(7)

LCM

Simple

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 } Output 42

Vector as argument

Program rs use euc_lib; fn main() { println!("{:?}", lib::lcm_from_vec(vec![12,4,8])) } Output Ok(24)