求解
{x≡a1 (mod m1)x≡a2 (mod m2)x≡a3 (mod m3)...x≡an (mod mn)" role="presentation">⎧⎩⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪x≡a1 (mod m1)x≡a2 (mod m2)x≡a3 (mod m3)...x≡an (mod mn)
中国剩余定理
若m1,m2,m3,...,mn" role="presentation">m1,m2,m3,...,mn两两互质,则可用中国剩余定理
设M=∏i=1nmi" role="presentation">M=∏ni=1mi,Mi=M/mi" role="presentation">Mi=M/mi,ti" role="presentation">ti为Mi" role="presentation">Mi在(mod mi)" role="presentation">(mod mi)意义下的逆元,那么通解为
x=kM+∑i=1naitiMi" role="presentation">x=kM+∑i=1naitiMi
解释一下: 懒得证
因为tiMi≡1 (mod mi)" role="presentation">tiMi≡1 (mod mi),而Mj≡0 (mod mi) (j≠i)" role="presentation">Mj≡0 (mod mi) (j≠i),所以整个求和式子中,模mi" role="presentation">mi有用的就只剩下aitiMi≡ai (mod mi)" role="presentation">aitiMi≡ai (mod mi),对每一个mi" role="presentation">mi都如此,满足所有条件。
通用解法
不要求m1,m2,m3,...,mn" role="presentation">m1,m2,m3,...,mn