gcd_extended: Implementation of the extended form of the Euclidean...

Description Usage Arguments Value References Examples

Description

The extended Euclidean algorithm computes the greatest common divisor, d of two integers a and b as well as the coefficients x and y such that:

d = gcd(a, b) = ax + by

The coefficients x and y are known as Bezout's coefficients and can be zero or negative.

Usage

1

Arguments

a

First integer

b

Second integer

Value

vector containing coefficients (d, x, y)

References

Bezout's identity. (2017, May 12). In Wikipedia, The Free Encyclopedia. From https://en.wikipedia.org/w/index.php?title=B Cormen, T., Leiserson, C., Rivest, R., & Stein, C. (2009). Introduction to algorithms (3rd ed., pp. 937-938). Cambridge (Inglaterra): Mit Press.

Examples

1
2
gcd_extended(99, 78)
gcd_extended(55, 45)

aschleg/numberr documentation built on May 14, 2019, 10:31 a.m.