pub fn extended_gcd(a: i64, b: i64) -> (u64, i64, i64)Expand description
Extended Euclidean algorithm: returns (g, x, y) such that
a*x + b*y = g = gcd(|a|, |b|). g is always non-negative.
ยงExamples
use mathverse_core::integer::extended_gcd;
let (g, x, y) = extended_gcd(48, 18);
assert_eq!(g, 6);
assert_eq!(48 * x + 18 * y, 6);