Literature
Kumanduri and Romero, Number theory with computer application
Knuth, Seminumerical Algorthms, The Art of Computer Programming
Cohn, Advanced Number Theory
Let r[i] (remainders) and m[i] (moduli) be integers
Study a system of n simultaneous congruences
x ≡ r[i] mod m[i] i = 1...n
Given are the values of r[i] and m[i]
Chinese Remainder Theorem
Let

A constructive PROOF at the the MAIN PROGRAM below
Generalizaton of the theorem above (without pairwise relatively prime)
...The system of congruences
x ≡ 
has a solution if and only if
for all i ≠ j GCD(

For given r[i] and m[i] i= 1 ... n we wish to determine x (if it exists)
DESIGN
1. Is there is a solution to the system?
Y there is go to 2 ...
N otherwise break
2. There is a solution
are the moduli pairwise relative prime?
Y go to 3 Main Program
N otherwise factorize the moduli and make a new list of
then go to 3
3. Solve with Main Program