Algorithm - 求两个整数的最大公约数(GCD)的几种算法

公约数和最大公约数 公约数 在这里,我们约定集合 $\mathbb{Z} = \{\dots, -2, -1, 0, 1, 2, \dots\}$ 表示所有的整数,集合 $\mathbb{N} = \{0, 1, 2, \dots\}$ 表示所有的自然数。 对于任意的实数 $x$,将小于等于 $x$ 的最大整数记作 $\lfloor x \rfloor$,读作 “the floor of $x$”。对于任意的整数 $a$ 和任意正整数 $n$,$a \operatorname{mod} n$ 表示 $a / n$ 的余数(remainder or residue),也就是说: ...

 发布时间: 2025-08-14