# Chinese theorem

Returns the solution of the system of equations given by the Chinese theorem: let ${n}_{1},...,{n}_{k}$ be integers greater than 1, and let us denote by $N$ the product of the ${n}_{i}$. The Chinese remainder theorem states that if the ${n}_{i}$ are pairwise coprime, and if ${a}_{1},...,{a}_{k}$ are any integer, $0\le {a}_{i}<{n}_{i}$, then there exists an integer $x$ such that

$\begin{array}{c}x\equiv {a}_{1}\left(\text{mod}{n}_{1}\right)\\ ⋮\\ x\equiv {a}_{k}\left(\text{mod}{n}_{k}\right)\end{array}$

and two such $x$ are congruent modulo $N$.

## Syntax

```chinese_theorem(Integer, Integer, Integer, Integer)
```
```chinese_theorem(List, List)
```

## Description

Given four integers ${a}_{1}$, ${a}_{2}$, ${n}_{1}$, ${n}_{2}$, returns $x$, the solution of the system of equations described above.

Given two lists $\left\{{a}_{1},...,{a}_{k}\right\}$ and $\left\{{n}_{1},...,{n}_{k}\right\}$, returns $x$, the solution of the system of equations described above.