Skip to main content

Extended gcd

Returns the final results of the extended Euclidean algorithm: an extension to the Euclidean algorithm which computes, besides the greatest common divisor of integers a and b, the coefficients of Bézout's identity, which are integers x and y such that ax+by=gcd(a,b)

Syntax

extended_gcd(Integer, Integer)

Description

Given two integers aa and bb, returns a vector with three elements: the first one is the greatest common divisor of aa and bb, the second and the third ones are xx and yy, with the notation used above.

arithmetic.extended_gcd.calc.png