Modular Arithmetic and Primes
Arithmetic with remainders ("clock arithmetic"), and the primes: unique factorisation, greatest common divisors and Fermat's little theorem.
Needs a step first: 1
Two integers are congruent modulo , written , if they leave the same remainder on division by ; you can add and multiply while keeping only remainders. Every integer above 1 factors into primes in exactly one way, Euclid's algorithm finds greatest common divisors fast, and Fermat's little theorem says when the prime does not divide . These facts power public-key cryptography (RSA) and the period-finding in Shor's algorithm, and give the first examples of groups.
Where it shows up: RSA encryption is modular powers, hash functions and checksums use remainders, and Shor's quantum algorithm factors numbers by finding the period of .
How to hold it: In your head
See arithmetic modulo as arithmetic on a clock, and explain why Euclid's algorithm finds a gcd and why Fermat's little theorem cuts a huge power down to size; leave big moduli to the computer.
What knowing it looks like
- Find the remainder of a large power such as modulo 7 without a calculator.
- Run Euclid's algorithm to find and use it backwards to solve .
- Explain why there are infinitely many primes.
Test yourself
Find the remainder when is divided by .
Show the worked answer
Needs a step first: 1
Learn it with an AI
Copy this prompt into any AI assistant. It will take you through step by step at your level and finish with the test above.
Be my maths tutor. I'm learning "Modular Arithmetic and Primes" (Core tier): Arithmetic with remainders ("clock arithmetic"), and the primes: unique factorisation, greatest common divisors and Fermat's little theorem.
I already know: Logic and Proof.
Teach it Socratically: first ask what I already know; then explain the core idea with one concrete example and why it's true; then give me three problems, one at a time, easy to hard. Wait for my answer, check every step, and point out mistakes without giving the answer away.
Finish by testing me with this: Find the remainder when $3^{100}$ is divided by $7$.
Use LaTeX for formulas. When you say where it's used later (machine learning, quantum mechanics), be specific.Needs first
Leads to
- Public-Key Cryptography (RSA)A way to let anyone lock a message that only one person can unlock, built on modular powers and the difficulty of factoring.Undergraduate I · Proof & Discrete Maths
- Grover's and Shor's AlgorithmsGrover's algorithm searches items in about steps; Shor's factors large numbers fast by finding a period with the quantum Fourier transform.Frontier · Quantum Mechanics
On the way to
Recommended
- Book of ProofRichard Hammack · BookA free textbook that teaches how to read and write proofs, from logic and sets through induction and contradiction, with many exercises and solutions.
- MIT 6.1200J Mathematics for Computer ScienceMIT OpenCourseWare · CourseMIT's 2024 course on proofs, number theory, graphs, counting and discrete probability, with lecture videos, notes and problem sets.
- Linear Algebra Done RightSheldon Axler · BookThe standard proof-based second course in linear algebra, built on linear maps rather than determinants; the 4th edition is free to read, also in Chinese.