TITLE: Chinese remainder theorem for non-prime / non-coprime moduli
QUESTION [8 upvotes]: If I want to find some number $x$ where it leaves a remainder when divided by some prime $p$, and another remainder when divided by some prime $q$, and so on, I can use the Chinese Remainder Theorem.
However, what about when $p$ and $q$ are not prime nor coprime?

REPLY [6 votes]: The general result is the following:
The system of congruences $ x\equiv a_i  \mod{m_i} \quad(i=1,\dots,r) $ has a solution  if and only if for each pair $(i,j)$, $\,\, a_i\equiv a_j \mod{m_i\wedge m_j} $. The solution is unique modulo $\mathrm{lcm}(m_1, \dots, m_r) $.