// NUMBER THEORY · ADVANCED
Chinese Remainder TheoremTurn many remainder clues into one exact answer. The CRT is the master key behind cryptography and modular problem solving.
Prerequisites: Modular arithmetic · GCD / Euclidean algorithm · Modular inverses
// VISUALIZER
Brute-force the congruences
Start with the first congruence and add m until the second congruence is satisfied. CRT guarantees a solution when m and n are coprime.
Press PLAY to search for the smallest x that satisfies both congruences.
// MINI GAME
CRT Lock Puzzle
Two congruences, four keys. Pick the correct x before the timer runs out. Correct answers reset the lock with a new challenge.
Loading lock...
// FLOWCHART
Algorithm flow
Press PLAY to trace the algorithm through the flowchart.
// PSEUDOCODE
Trace the code
Press PLAY to step through the algorithm line by line.
// TUTORIAL QUIZZES
Test your mastery
From reading congruences to building the CRT formula and applying it to cryptography.
// PRACTICE & ASSESS
Test your understanding
Now that you've learned the concept, put it into practice. Solve coding problems and take quizzes to reinforce what you've learned.
// REFERENCES
Sources & further reading
- [1]Sunzi Suanjing — Chinese Remainder TheoremSunzi (3rd–5th century) — earliest known statement
- [2]Introduction to Algorithms (CLRS)T. H. Cormen et al. — Modular arithmetic and number theory
- [3]A Course in Number Theory and CryptographyNeal Koblitz — CRT and public-key cryptography
- [4]The Art of Computer Programming, Vol. 2Donald Knuth — Seminumerical Algorithms, modular computation
// READY?
All four number-theory tutorials are live
You now have GCD & Euclidean, Sieve of Eratosthenes, Prime Factorization, and Chinese Remainder Theorem — each with games, quizzes, and full SEO.