Number theory is the study of whole numbers-integers-and the surprising patterns hiding inside them. It’s the branch of math where questions can sound like playground dares (“Can you split this number into primes in only one way?”) and end up powering modern cryptography. But you don’t need to be a specialist to enjoy it. All you need is curiosity and a willingness to follow a few examples.
Let’s take a walk through some of the greatest “characters” in number theory: primes, remainders, modular arithmetic, and a few classic theorems that feel like magic the first time you see them.
1) Primes: the “atoms” of arithmetic
A prime number is an integer greater than whose only positive divisors are and itself:
Why do primes matter? Because every integer bigger than can be built from them.
Example: prime factorization
Take . Divide by primes:
So:
This is not just a trick-it’s a theorem.
The Fundamental Theorem of Arithmetic
Every integer can be written as a product of primes uniquely (ignoring order).
That “uniquely” is huge. It means integers have a stable “DNA”.
2) A proof that never gets old: infinitely many primes
Here’s a classic argument, going back over two thousand years.
Assume (for contradiction) there are only finitely many primes:
Now build this number:
When you divide by any prime , you get a remainder of . So none of the listed primes divides . Therefore, is either prime itself, or divisible by a prime not in the list-either way, we found a new prime. Contradiction.
So, primes never end. The list goes on forever, like a cosmic spreadsheet you can scroll forever without reaching the bottom.
3) Remainders as a superpower: modular arithmetic
When we say:
we mean a and b leave the same remainder when divided by m, i.e. .
Example: clock arithmetic
A clock is arithmetic mod .
If it’s 10 o’clock and you wait 5 hours:
So it’s 3 o’clock.
Modular arithmetic turns messy problems into tidy ones because it lets you ignore everything except remainders.
4) A “remainder trick” for divisibility
You’ve probably seen rules like “a number is divisible by if the sum of its digits is divisible by .” That’s modular arithmetic in disguise.
Why does it work? Because:
So:
That means a number like behaves like:
So is divisible by . Nice and clean.
5) The Euclidean Algorithm: the fastest way to find a GCD
The greatest common divisor $\gcd(a,b)$ is the biggest integer dividing both a and b.
The Euclidean algorithm says:
Repeat until the remainder is .
Example: $\gcd(252, 198)$
Compute remainders:
So:
This is one of the most practical number theory tools ever invented. It’s also the engine behind modular inverses (which we’ll use soon).
6) When division does work: modular inverses
In ordinary arithmetic, dividing by a means multiplying by . In modular arithmetic, division is trickier—but sometimes it works.
A number is the modular inverse of a if:
This exists only if $\gcd(a,m)=1$.
Example: inverse of mod
We want . Try values:
So .
This concept-multiplying by inverses mod a large number-is a backbone of cryptography.
7) Fermat’s Little Theorem: a tiny sentence with huge consequences
If is prime and is not divisible by , then:
Example:
Since is prime:
So the remainder is immediately-no need to compute .
You can also use this to find inverses:
For instance, mod :
(There are faster ways to compute, but the theorem guarantees it.)
8) The Chinese Remainder Theorem: solving “remainder puzzles”
CRT says: if moduli are coprime, systems of congruences have a unique solution modulo their product.
Example: find $x$ such that
Let’s list numbers :
Which of these is ?
Check remainders mod :
So . And all solutions are:
CRT is like a lockpick for remainder constraints. It appears in scheduling problems, hashing, coding theory, and cryptography.
9) A famous unsolved feeling (but solvable) problem: sums of squares
Here’s a classic question: which numbers can be written as a sum of two squares?
Examples:
A deep theorem says (roughly): in the prime factorization of , any prime congruent to must appear with an even exponent for to be a sum of two squares.
Example: is $45$ a sum of two squares?
Here , and it appears with exponent (even). Good sign. Indeed:
Example: is $21$ a sum of two squares?
Prime appears with exponent (odd). That blocks it. And indeed, you won’t find integers with .
This is a beautiful example of number theory’s style: prime remainders mod decide geometry.
10) Why this matters (even if you don’t “need” it)
Number theory has a unique vibe: simple rules, unexpected depth. You can understand the questions quickly, but the answers can be profoundly non-obvious. And it’s not just aesthetic-these ideas power real systems:
- Cryptography uses modular arithmetic and primes to secure communication.
- Error-correcting codes use arithmetic structure to fix corrupted data.
- Computer algorithms rely on gcds, modular inverses, and prime testing.
But even outside applications, number theory is satisfying because it feels like uncovering hidden laws in a world you thought you already understood. Integers look plain. Then you learn they have social patterns, secret relationships, and entire ecosystems built out of remainders.
