Iurii Storozhenko

Ph.D. candidate · Travel enthusiast

Remainders, Primes, and Hidden Patterns: Number Theory’s Greatest Hits

Remainders, Primes, and Hidden Patterns: Number Theory’s Greatest Hits

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 11 whose only positive divisors are 11 and itself:

2,3,5,7,11,13,17,2, 3, 5, 7, 11, 13, 17, …

Why do primes matter? Because every integer bigger than 11 can be built from them.

Example: prime factorization

Take 360360. Divide by primes:

  • 360=2180360 = 2 \cdot 180

  • 180=290180 = 2 \cdot 90

  • 90=24590 = 2 \cdot 45

  • 45=31545 = 3 \cdot 15

  • 15=3515 = 3 \cdot 5

So:

360=23325360 = 2^3 \cdot 3^2 \cdot 5

This is not just a trick-it’s a theorem.

The Fundamental Theorem of Arithmetic

Every integer n>1n>1 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:

p1,p2,,pkp_1, p_2, \dots, p_k

Now build this number:

N=p1p2pk+1N = p_1p_2\cdots p_k + 1

When you divide NN by any prime pip_i, you get a remainder of 11. So none of the listed primes divides NN. Therefore, NN 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:

ab(modm)a \equiv b \pmod{m}

we mean a and b leave the same remainder when divided by m, i.e. m(ab)m\mid(a-b).

Example: clock arithmetic

A clock is arithmetic mod 1212.

If it’s 10 o’clock and you wait 5 hours:

10+5=153(mod12)10 + 5 = 15 \equiv 3 \pmod{12}

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 33 if the sum of its digits is divisible by 33.” That’s modular arithmetic in disguise.

Why does it work? Because:

101(mod3)10 \equiv 1 \pmod{3}

So:

10k1k=1(mod3)10^k \equiv 1^k = 1 \pmod{3}

That means a number like 528528 behaves like:

528=5102+2101+85+2+8=150(mod3)528 = 5\cdot 10^2 + 2\cdot 10^1 + 8 \equiv 5 + 2 + 8 = 15 \equiv 0 \pmod{3}

So 528528 is divisible by 33. 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:

gcd(a,b)=gcd(b,amodb)\gcd(a,b) = \gcd(b, a \bmod b)

Repeat until the remainder is 00.

Example: $\gcd(252, 198)$

Compute remainders:

  • 252=1981+54252 = 198\cdot 1 + 54

  • 198=543+36198 = 54\cdot 3 + 36

  • 54=361+1854 = 36\cdot 1 + 18

  • 36=182+036 = 18\cdot 2 + 0

So:

gcd(252,198)=18\gcd(252,198) = 18

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 1/a1/a. In modular arithmetic, division is trickier—but sometimes it works.

A number xx is the modular inverse of a (modm)\pmod{m} if:

ax1(modm)ax \equiv 1 \pmod{m}

This exists only if $\gcd(a,m)=1$.

Example: inverse of 33 mod 77

We want 3x1(mod7)3x \equiv 1 \pmod{7}. Try values:

  • 31=33\cdot 1 = 3

  • 32=63\cdot 2 = 6

  • 33=923\cdot 3 = 9 \equiv 2

  • 34=1253\cdot 4 = 12 \equiv 5

  • 35=1513\cdot 5 = 15 \equiv 1

So x=5x=5.

315(mod7)3^{-1} \equiv 5 \pmod{7}

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 pp is prime and aa is not divisible by pp, then:

ap11(modp)a^{p-1} \equiv 1 \pmod{p}

Example: 210mod112^{10} \mod 11

Since 1111 is prime:

2111=2101(mod11)2^{11-1} = 2^{10} \equiv 1 \pmod{11}

So the remainder is 11 immediately-no need to compute 10241024.

You can also use this to find inverses:

a1ap2(modp)a^{-1} \equiv a^{p-2} \pmod{p}

For instance, mod 1111:

2129(mod11)2^{-1} \equiv 2^9 \pmod{11}

(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

x2(mod3),x3(mod5)x \equiv 2 \pmod{3}, \quad x \equiv 3 \pmod{5}

Let’s list numbers 2(mod3)\equiv 2 \pmod{3}:

2,5,8,11,14,17,2,5,8,11,14,17,\dots

Which of these is 3(mod5)\equiv 3 \pmod{5}?

Check remainders mod 55:

  • 222 → 2

  • 505 → 0

  • 838 → 3

So x=8x=8. And all solutions are:

x8(mod15)x \equiv 8 \pmod{15}

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?

n=a2+b2n = a^2 + b^2

Examples:

  • 5=12+225 = 1^2 + 2^2

  • 10=12+3210 = 1^2 + 3^2

  • 25=02+52=32+4225 = 0^2 + 5^2 = 3^2 + 4^2

A deep theorem says (roughly): in the prime factorization of nn, any prime congruent to 3(mod4)3 \pmod{4} must appear with an even exponent for nn to be a sum of two squares.

Example: is $45$ a sum of two squares?

45=32545 = 3^2 \cdot 5

Here 33(mod4)3 \equiv 3 \pmod{4}, and it appears with exponent 22 (even). Good sign. Indeed:

45=32+6245 = 3^2 + 6^2

Example: is $21$ a sum of two squares?

21=3721 = 3\cdot 7

Prime 33(mod4)3 \equiv 3 \pmod{4} appears with exponent 11 (odd). That blocks it. And indeed, you won’t find integers a,ba,b with a2+b2=21a^2+b^2=21.

This is a beautiful example of number theory’s style: prime remainders mod 44 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.