知识卡片

普通读书笔记卡 · 3697.c

取余不改变最大公约数

理解等级:中级

对非负整数a与正整数b,有gcd(a,b)=gcd(b,a mod b)。因为a mod b=a−⌊a/b⌋b,两组数生成相同的公共因子;这条递推式是欧几里得算法的正确性核心。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

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

      Theorem 31.9 (GCD recursion theorem) For any nonnegative integer a and any positive integer b, gcd(a, b) = gcd(b, a mod b). Proof We will show that gcd(a, b) and gcd(b, a mod b) divide each other. Since they are both nonnegative, equation (31.5) then implies that they must be equal. We first show that gcd(a, b)

    参考来源

    - 位置:《算法导论(第4版)》第31章《数论算法》(OEBPS/chapter031.xhtml,文本字符[15000,20000))。 - 结论依据:原文给出最大公约数递推、扩展算法或模运算群的定义和证明;公式图已核对。 - 原始内容:Theorem 31.9 (GCD recursion theorem) For any nonnegative integer a and any positive integer b , gcd( a , b ) = gcd( b , a mod b ). Proof We will show that gcd( a , b ) and gcd( b , a mod b ) divide each other. Since they are both nonnegative, equation (31.5) then implies that they must be equal. We first show that gcd( a , b )