Chinese theorem

Returns the solution of the system of equations given by the Chinese theorem: let be integers greater than 1, and let us denote by the product of the . The Chinese remainder theorem states that if the are pairwise coprime, and if are any integer, , then there exists an integer such that

and two such are congruent modulo .

chinese_theorem(Integer, Integer, Integer, Integer)

Given four integers , , , , returns , the solution of the system of equations described above.

chinese_theorem(List, List)

Given two lists and , returns , the solution of the system of equations described above.