您的位置:首页 > 其它

Greatest common divisor

2006-09-15 14:15 232 查看
We define the greatest common divisor of two integers m and n is the largest integer that divides them both. gcd(m,n) = max{k | k/m and k/n}.
One of the nicest properties of the gcd is that it is easy to computer,using a 2300-year-old method called Euclid's algorithm: gcd(0,n) = n; gcd(m,n) = gcd(m,n mod m) [0<=m<n] ;For example , gcd(12,18) = gcd(6,12) = gcd(0,6) = 6. We can extend it that m' *m+n'*n = gcd(m,n).
Now let we prove it.
Let r = n mod m and gcd = gcd(m,n), we have n=k*m+r; and (m mod gcd) =0,(n mod gcd) = 0
∴ (k*m+r) mod gcd = 0.
∴ we have t and f, t*gcd = k*m+r; f*gcd = m
∴r=(t-k*f)gcd;
∴ r mod gcd =0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: