知识卡片

普通读书笔记卡 · 3697.c.1

欧几里得算法反复取余求公因数

理解等级:初级

欧几里得算法在b≠0时把(a,b)换成(b,a mod b),在b=0时返回a。第二参数每次严格减小且非负,故必终止;最大公约数递推式保证每一步保留答案。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 第31章 数论算法 · 查看原书依据

      The recursive procedure EUCLID implements Euclid’s algorithm, based directly on Theorem 31.9. The inputs a and b are arbitrary nonnegative integers. EUCLID(a, b) 1 if b == 0 2 return a 3 else return EUCLID(b, a mod b) For example, here is how the procedure computes gcd(30, 21): EUCLID(30, 21) = EUCLID(21, 9) = E

    参考来源

    - 位置:《算法导论(第4版)》第31章《数论算法》(OEBPS/chapter031.xhtml,文本字符[15000,20000))。 - 结论依据:原文给出最大公约数递推、扩展算法或模运算群的定义和证明;公式图已核对。 - 原始内容:The recursive procedure E UCLID implements Euclid’s algorithm, based directly on Theorem 31.9. The inputs a and b are arbitrary nonnegative integers. E UCLID ( a , b ) 1 if b == 0 2 return a 3 else return E UCLID ( b , a mod b ) For example, here is how the procedure computes gcd(30, 21): E UCLID (30, 21) = E UCLID (21, 9) = E