Main Content
gcd
Greatest common divisor
Description
Examples
Input Arguments
Output Arguments
Algorithms
g = gcd(A,B)
is calculated using the Euclidean algorithm.[1]
[g,u,v] = gcd(A,B)
is calculated using the extended Euclidean
algorithm.[1]
References
[1] Knuth, D. “Algorithms A and X.” The Art of Computer Programming, Vol. 2, Section 4.5.2. Reading, MA: Addison-Wesley, 1973.
Extended Capabilities
Version History
Introduced before R2006a