public int GCD(int a,int b) {
if(b==0)
return a;
else
return GCD(b,a%b);
}
因为如果a,b存在最大公约数,那么ab的余数也和a,b中小的数存在最大公约数