Chinese Remainder Challenge Generator
A number that leaves remainder 2 when divided by 3, 3 when divided by 5, and 2 when divided by 7 — Sun Tzu asked it in the third century, and the answer is 23. The theorem says that whenever the moduli are pairwise coprime there is exactly one answer below their product, and every problem here is built that way round: the answer is chosen first and the remainders derived from it, so a solution is guaranteed to exist.
What this generator does
Picks pairwise coprime moduli, chooses an answer below their product, and derives each congruence from it. The result is a system that always has exactly one solution in range, with the product stated so the general solution is clear.
How to use this tool
- Choose how many congruences you want.
- Solve the system by searching or by the standard construction.
- Reveal the answer and the product the solution is unique below.
- Check by dividing your answer by each modulus in turn.
Understanding the controls
- How many congruences
- Between 2 and 4. Each one added multiplies the range the answer is unique within.
- Seed
- Reproduces the same moduli and remainders, so a problem can be set and marked later.
- Show the answer
- Reveals the solution and the product of the moduli that every other solution differs by.
Common use cases
- Practice problems for the Chinese remainder theorem with guaranteed solutions
- Showing why pairwise coprime moduli are the condition, not a convenience
- Calendar and cycle problems in their abstract form
- Verifying a modular solver against known answers
- Setting the same system twice from a seed
How this generator works
Moduli are drawn from a small set and rejected unless coprime to all those already chosen. The check substitutes the stated solution into every congruence, confirms all moduli are pairwise coprime, and requires the answer to lie below their product — the range in which the theorem promises uniqueness.
Randomness and fairness
The moduli and the answer are random; that a solution exists and is unique follows from coprimality. Seeded systems reproduce exactly and are therefore explicitly not cryptographically secure, and unseeded ones use the browser's cryptographically secure generator.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- Moduli come from a fixed small set, so the same ones recur.
- Systems always have a solution by construction; the unsolvable non-coprime case is described but not generated.
- No construction is shown, only the answer — the search method is left to you.
- Congruences are in one unknown only.
- Systems are not stored between visits.
Privacy and your data
Moduli, remainders and the solution are computed in your browser. Nothing is transmitted or retained.
Related generators
- Modular Arithmetic Question GeneratorRemainders, modular powers by repeated squaring, and inverses that only exist when the values are coprime.
- Coprime Number GeneratorPairs sharing no factor beyond one, with a non-coprime counterexample and Euler's totient counted directly.
- GCD and LCM Question GeneratorHighest common factor and lowest common multiple questions with Euclid's algorithm written out and the product identity checked.
- Diophantine Equation GeneratorLinear equations in two unknowns over the integers, with the solvability test, a table of the solution family and the smallest non-negative answer.