Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Greatest common divisor

`G = gcd(A,B)`

```
[G,U,V]
= gcd(A,B)
```

`g = gcd(A,B)`

is calculated using the Euclidian
algorithm.[1]

`[g,u,v] = gcd(A,B)`

is calculated using the
extended Euclidian algorithm.[1]

[1] Knuth, D. “Algorithms A and X.” *The
Art of Computer Programming, Vol. 2*, Section 4.5.2. Reading,
MA: Addison-Wesley, 1973.

Was this topic helpful?