g = gcd(a,b)
[g,c,d] = gcd(a,b)
g = gcd(a,b)
is the greatest common divisor of the integers a
and b
. By convention, gcd(0,0)
returns a value of 0; all other inputs return positive integers.
[g,c,d] = gcd(a,b)
also returns the scalars c
and d
such that g = a
*c+b
*d
.
[g,c,d] = gcd(80,120)
g =
40
c =
-1
d =
1
lcm
(c) Copyright 1994 by The MathWorks, Inc.