计算两个整数的最大公因数,假设M>=N
long gcd(long m, long n) { while (n!=0) { long rem = m%n; m = n; n = rem; } return m; }