求最大公约数和最小公倍数算法
翻译
GCD(greatest common divisor): 最大公约数
例
25和35的最大公约数为5
欧几里得算法(Euclidean algorithm), 辗转相除法

GCD算法1
1 | public int gcd(int a, int b) { |
GCD算法2
1 | public int gcd(int a, int b) { |
翻译
LCM(least common multiple): 最小公倍数
算法1
1 | public int lcm(int a, int b) { |