Chinese Remainder Theorem (CRT)

CRT is used to speed up modulo computations by computing smaller moduli \(m_i\) in the Set \(\mod M = m_1 m_2 \ldots m_3\) instead of full modulus \(M\).

For example, to compute \(A (\mod M)\):

  • Do a Prime Factorisation on \(M\) to find out \(m_i\)
  • Calculate \(M_i = M / m_i\)
  • List a set of linear congruences using \(M_i b_i = 1 (\mod m_i) \rightarrow r_i b_i\) where \(r_i\) is \(M_i \mod m_i\) and find out the inverse# \(r_i^{-1}\) which is \(b_i\) at the same time
  • Knowing \(c_i\) is actually \(M_i b_i\), sums up the result with \(A \equiv (\sum_{i=1}^k a_i c_i) (\mod M)\)
Links to this page
#math #review