1 | int gcd(int a,int b) { |
1. Make
-
-
c is the biggest divisor
2. Got
3. c is a divisor of r as well.
4. m-kn and n definitely has coprime relation
proof by contradiction
setting they are no coprime relation
-
(d>1)then
-
-
aandb‘s biggest divisor is notc. so step 4 proved.
5. c is biggest divisor in b and r as well.
-