SOLID STATE PRESS
← Back to catalog
Modular Arithmetic cover
Coming soon
Coming soon to Amazon
This title is in our publishing queue.
Browse available titles
Mathematics

Modular Arithmetic

Congruences, Modular Inverses, and Fermat's Little Theorem — A TLDR Primer

Modular arithmetic shows up on your next exam before you feel ready for it — and most textbooks bury the useful parts under pages of proof-heavy theory before you ever work a real problem.

This TLDR primer cuts straight to what matters. Starting with the clock-arithmetic intuition behind congruences, it builds quickly through the rules for adding, subtracting, and multiplying mod n, then tackles the part that trips most students up: why division requires a modular inverse, when that inverse exists, and how to find it with the Extended Euclidean Algorithm. From there, repeated squaring makes large-power problems tractable, and Fermat's Little Theorem — one of the genuinely beautiful results in elementary number theory — shows you how to collapse an exponent that looks impossible into one you can handle by hand.

The final section connects all of it to the real world: the check-digit schemes behind ISBNs and credit cards, the logic of hash functions, and the core mathematics of RSA public-key cryptography. These aren't decorative applications — they're the reason number theory for competition math and computer science students has exploded in popularity.

Short by design, with every definition in plain English and every technique shown through worked examples before it's stated as a rule. Whether you're prepping for a competition, a discrete math course, or just want to finally understand how RSA actually works, this guide gets you there without the bloat.

Scroll up and grab your copy.

What you'll learn
  • Read and write congruences fluently and reduce expressions mod n
  • Add, subtract, multiply, and exponentiate in modular arithmetic without errors
  • Find modular inverses using the Extended Euclidean Algorithm
  • Apply Fermat's Little Theorem and Euler's theorem to compute large powers mod n
  • Recognize where modular arithmetic shows up: divisibility rules, check digits, and RSA cryptography
What's inside
  1. 1. Clock Arithmetic: What 'mod' Actually Means
    Introduces the modulus, the congruence relation a ≡ b (mod n), and the intuition of wrapping around a clock.
  2. 2. Arithmetic Mod n: Adding, Subtracting, Multiplying
    Shows that addition, subtraction, and multiplication respect congruence, with worked examples and the standard tricks for reducing as you go.
  3. 3. Division and Modular Inverses
    Explains why division is tricky mod n, when an inverse exists (gcd(a, n) = 1), and how to find it with the Extended Euclidean Algorithm.
  4. 4. Powers Mod n: Fast Exponentiation and Fermat's Little Theorem
    Develops repeated squaring for large powers and introduces Fermat's Little Theorem and Euler's theorem for collapsing exponents.
  5. 5. Where This Shows Up: Check Digits, Hashing, and RSA
    Connects modular arithmetic to ISBN/credit card check digits, hash functions, and the core idea behind RSA public-key cryptography.
Published by Solid State Press
Modular Arithmetic cover
TLDR STUDY GUIDES

Modular Arithmetic

Congruences, Modular Inverses, and Fermat's Little Theorem — A TLDR Primer
Solid State Press

Contents

  1. 1 Clock Arithmetic: What 'mod' Actually Means
  2. 2 Arithmetic Mod n: Adding, Subtracting, Multiplying
  3. 3 Division and Modular Inverses
  4. 4 Powers Mod n: Fast Exponentiation and Fermat's Little Theorem
  5. 5 Where This Shows Up: Check Digits, Hashing, and RSA
Chapter 1

Clock Arithmetic: What 'mod' Actually Means

Picture a clock on the wall. It has twelve positions — 1 through 12 — and after you hit 12, you wrap back around to 1. If it is 10 o'clock now and three hours pass, the clock reads 1, not 13. That wrap-around is the central idea of modular arithmetic, and it turns out to be one of the most useful tools in mathematics.

Modular arithmetic is arithmetic on a finite set of remainders. The key number controlling the wrap-around is called the modulus, written $n$. Every integer gets assigned a position in the range $0, 1, 2, \ldots, n-1$ based on what remainder it leaves when divided by $n$. On a 12-hour clock the modulus is 12, and positions run from 0 through 11 (midnight plays the role of 0).

The Remainder Definition

When you divide an integer $a$ by a positive integer $n$, the division algorithm guarantees you can write

$a = qn + r \quad \text{where } 0 \le r < n.$

Here $q$ is the quotient and $r$ is the remainder (also called the residue). The remainder $r$ is what modular arithmetic cares about. We write

$a \bmod n = r.$

For example, $17 \bmod 5 = 2$ because $17 = 3 \cdot 5 + 2$. The 5 goes in three times and you have 2 left over.

A common mistake is to confuse $a \bmod n$ (a computation that produces a single number) with the congruence notation introduced next. They are related but not the same thing.

Congruence

Two integers $a$ and $b$ are congruent modulo $n$ if they leave the same remainder when divided by $n$. The notation is

$a \equiv b \pmod{n}.$

Read this aloud as "$a$ is congruent to $b$ mod $n$." The three-bar symbol $\equiv$ signals congruence, not plain equality.

An equivalent and often more useful characterization: $a \equiv b \pmod{n}$ if and only if $n$ divides $a - b$. In symbols, $n \mid (a - b)$. These two descriptions say exactly the same thing, and you will find yourself switching between them constantly.

About This Book

If you are looking for a modular arithmetic study guide aimed at high school students — or you are a college freshman who just hit the number theory unit and felt the floor drop out — this book is for you. It is also useful for anyone prepping for AMC, AIME, or similar contests where clock arithmetic and divisibility rules come up constantly, making it a practical entry point for number theory for competition math beginners.

This congruence and number theory math primer covers the core ideas in a tight sequence: what "mod" means, how to add and multiply with congruences, how to find a modular inverse explained simply with worked steps, how to handle large exponents using Fermat's Little Theorem practice problems, and how these ideas power RSA cryptography math basics for students who want to see real-world stakes. Short by design, no filler.

Read straight through once, following each worked example with pencil in hand. Then attempt the problem set at the end to find out what you actually know.

Keep reading

You've read the first half of Chapter 1. The complete book covers 5 chapters in roughly fifteen pages — readable in one sitting.

Coming soon to Amazon