Skip to content

Commit

Permalink
add extended_gcd docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonwalters committed Feb 17, 2025
1 parent d6891ff commit bfeb0a9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ fn mod_exp(mut base: i64, mut exp: i64, p: i64) -> i64 {
}

/// Extended Euclidean algorithm
/// # Arguments
///
/// * `a` - First number.
/// * `b` - Second number.
///
/// # Returns
/// A tuple with the greatest common divisor and the Bézout coefficients.
fn extended_gcd(a: i64, b: i64) -> (i64, i64, i64) {
if b == 0 {
(a, 1, 0) // gcd, x, y
Expand Down

0 comments on commit bfeb0a9

Please sign in to comment.