Chinese remainder theorem (source code)

= Chinese remainder theorem
{wiki=Chinese_remainder_theorem}

The Chinese Remainder Theorem (CRT) is a result in number theory that provides a way to solve systems of simultaneous congruences with different moduli. It states that if you have several congruences with pairwise coprime moduli, there exists a unique solution modulo the product of those moduli. \#\#\# Formulation If \\( n_1, n_2, \\ldots, n_k \\) are pairwise coprime integers (i.e.