Euclid's algorithms for GCD
来源:互联网 发布:sas编程技术教程 编辑:程序博客网 时间:2024/05/17 08:19
GCD is the greatest common divisor. pseudo-code:
function Euclid(x,y)
if y==0 return x;
return Euclid(y, x MOD y).
correctness:
Euclid's rule: If x and y are positive integers with x >= y, then gcd(x, y) = gcd(x mod y, y).
Prove: just to prove gcd(x, y) = gcd(x-y, y). Let GCD is k, then if k can divide x and y, then k can also divide x-y, so gcd(x, y) <= gcd(x-y, y). On the other hand, if k can divide x-y and y, then k can also divide x, so gcd(x, y) >= gcd(x-y, y). Thus the rule is proved.
running time:O( n3)
- Euclid's algorithms for GCD
- Euclid's GCD Algorithm——MIT Open Courseware(Computability)
- 【poj2348】Euclid's Game
- euclid's algorithm
- poj2348 - Euclid's Game
- HDU1525 Euclid's Game
- POJ2348:Euclid's Game
- hdu1525 Euclid's Game
- Euclid's Game
- Euclid's Game(0099)
- Algorithm: Euclid's Algorithm
- OpenJudge1350 Euclid's Game
- Euclid‘s algorithm
- Euclid's Game---博弈
- poj2348 Euclid's Game
- 最大公约数(gcd):Euclid算法证明
- 最大公约数(gcd):Euclid算法证明
- TZC 2414 Euclid's Game
- C#中的 int?是什么意思
- Linux2.6块设备驱动程序
- C#遍历指定文件夹中的所有文件
- velocity 判空
- 【Ajax】参考资料
- Euclid's algorithms for GCD
- ftpj4图解
- SQL中获取一个关键字在某个字符串出现次数
- 回调函数及使用方法
- DWZ框架常见问题及解决
- android java Socket多文件发送
- 文件拷贝 (Copy content from file1 to file2)
- extjs的combobox传值问题
- 添加/sbin到环境变量