Say we have a natural number $x_1$ modulo a natural number $m_1$, and another natural $x_2$ modulo a natural $m_2$. I'm looking for a function that combines the values so that we get the result of using the Chinese remainder theorem on the numbers. In other words, I'm looking for a formula that would combine results modulo 3 and modulo 5 into results modulo 15, or modulo $3^2 \cdot 5$ and modulo $5 \cdot 7$ into modulo $3^2 \cdot 5 \cdot 7$. I'm really looking for a general method to find functions devoted to specific moduli.
It's a major bonus if this formula is easy to incorporate into a summation, but that may be a tough order.