知识卡片
取余不改变最大公约数
对非负整数a与正整数b,有gcd(a,b)=gcd(b,a mod b)。因为a mod b=a−⌊a/b⌋b,两组数生成相同的公共因子;这条递推式是欧几里得算法的正确性核心。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 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 )