\(gcd(a, b) == gcd(b, a\%b)\)
證實:
設: \(d\)爲\(a\)與\(b\)的一個公約數, 則有\(d|b\) \(d|a\)ui
設: \(a = k \times b + r\) 則有\(r = a \% b\)
\(r = a - kb\) 同除以\(d\)可得
\(r \over d\) \(=\) $ a \over d$ \(-\) \(kb\over d\)
又$ \because d|b , d|a$
\(\therefore d | r\)
即 \(d | a\%b\), \(d\)爲\(a\%b\)的一個因數.
又 \(\because d|b\)
\(\therefore d\) 爲\(b\)與\(a\%b\)的一個公約數,
若\(d\)最大,則\(d\)爲\(b\)與\(a\%b\)的最大公約數,
\(\therefore gcd(a, b) = gcd(b, a \% b)\) 得證spa
要使\(ax + by = m\)(\(a, b \in Z\)) 有整數解的充要條件是 \(m \% gcd(a, b) = 0\)
證實:
設\(d = gcd(a, b)\) 則 \(d | a \ d | b\) .
又\(\because x, y\) 爲整數 \(\therefore d | ax + by\)
\(\because ax + by = m\) \(\therefore d | m\)
則 \(m \% gcd(a, b) = 0\).code
當a 與 p互質的時候則有 \(a^{\varphi(p)} \equiv 1 \ (mod \ p)\)
通項公式及證實:
若\(n = p ^ k ,p\)爲質數,則\(\varphi (p^k) = p ^k - p ^{k - 1}\)
當一個數不包含質因子\(p\)時就能與\(n\)互質,
小於等於\(n\)的數中包含質因子\(p\)的只有\(p^{k-1}\) 個,他們是:
\(p, 2*p, 3* p, ...,p ^{k - 1} ∗p\),把他們去除便可.ast
由惟一分解定理可得: \(n = p_1 ^{a_1} p_2 ^{a_2}p_3 ^{a_3}...p_k ^{a_k}\)
則 \(\varphi (n) = \varphi(p_1^{a_1})\varphi(p_2^{a_2})\varphi(p_3^{a_3})...\varphi(p_k^{a_k})\)class
根據上述\(\varphi (p^k) = p ^k - p ^{k - 1}\)可得:
$ \varphi (p) = p^k(1 - $\({1}\over {p^k}\))原理
則 \(\varphi (n) = \varphi(p_1^{a_1})\varphi(p_2^{a_2})\varphi(p_3^{a_3})...\varphi(p_k^{a_k})\)可化爲
\(\ \ \ \ \varphi (n) = p_1 ^{a_1}(1 - \frac {1} {p_1}) p_2 ^{a_2}(1 - \frac {1} {p_2})p_3 ^{a_3}(1 - \frac {1} {p_3})...p_k ^{a_k}(1 - \frac {1} {p_k})\)
\(\ \ \ \ \ \ \ \ \ \ \ = n (1 - \frac {1} {p_1})(1 - \frac {1} {p_2})(1 - \frac {1} {p_3})...(1 - \frac {1} {p_k})\)gc
\(\displaystyle \prod^{k}_{i= 1} (a_i + 1)\)
證實:
由惟一分解定理\(n = p_1 ^{a_1} p_2 ^{a_2}p_3 ^{a_3}...p_k ^{a_k}\)可得:
\(n\)的約數必定是 \(p_1^{x} ... p_k^{z}\) \(x \in [0, a_1] ... z \in [0, a_k]\)
每個能夠取 \(a_i +1\)種可能.
根據乘法原理約數個數\(= (a_1 + 1) \ast (a_2 + 1) \ast ...\ast (a_k + 1)\).
即: \[\displaystyle \prod^{k}_{i= 1} (a_i + 1)\]im
% m 同餘的數的集合.
ex:
% 5 餘 2 的數的集合:集合
2, 7, 12 ...
% m 可能出現的全部狀況
ex :
% 5可能出現的全部狀況就是:di
0, 1, 2, 3, 4