Achievable logoAchievable logo
AMC
Sign in
Sign up
Purchase
Textbook
Practice exams
Support
How it works
Exam catalog
Mountain with a flag at the peak
Textbook
Introduction
1. Algebra
2. Geometry
3. Number theory
3.1 Factors and multiples
3.2 Prime numbers
3.3 Modular arithmetic
4. Counting and probability
5. Intermediate topics (AMC 10/12)
6. Advanced topics (AMC 12)
7. General approaches
8. Practical strategies
Wrapping up
Achievable logoAchievable logo
3.3 Modular arithmetic
Achievable AMC
3. Number theory

Modular arithmetic

5 min read
Font
Discuss
Share
Feedback

This chapter applies to all AMC 8/10/12 test takers.

Modular arithmetic is about remainders in division. For example, when you divide 29 by 5, the remainder is 4. We write that as 29≡4(mod5).

The word “modular” comes from the Latin modulus, meaning a small measure. So 29≡4(mod5) is like saying: “If you measure 29 in chunks of 5, you have 4 left over.”

a≡b(modn)

The triple-bar equals sign means “congruent modulo.” The statement above reads: “a is congruent to b modulo n.” In practical terms, it means a and b leave the same remainder when divided by n.

Modular properties

Even though ≡ is not the same as =, you can still do many familiar algebra-like operations with congruences.

Here are three useful properties. For all three, assume:

  • a≡b(modn)
  • c≡d(modn)

In the examples, we’ll use a=9, b=4, c=7, d=2, and n=5, so:

9≡4(mod5) and 7≡2(mod5)

A key theme is that the modulus (the number after “mod”) must match. When two congruences share the same modulus, you can combine them using the operations below.

Addition

a+c≡b+d(modn)

When a≡b(mod5) and c≡d(mod5), a+c≡b+d(mod5)

if 9≡4(mod5) and 7≡2(mod5)

then 9+7≡4+2(mod5)

16≡6(mod5)

16≡1(mod5)

That last step is important. The number on the right side of ≡ is representing a remainder, so it should be written as a number less than the modulus. Since 6 is 1 more than 5, we replace 6 with 1.

Subtraction

a−c≡b−d(modn)

When a≡b(mod5) and c≡d(mod5), a−c≡b−d(mod5)

if 9≡4(mod5) and 7≡2(mod5)

then 9−7≡4−2(mod5)

2≡2(mod5)

Here, 2 is already less than 5, so no further simplification is needed.

This connects to a basic fact you’ll use often: x≡x(mody) when y>x.

Multiplication

a⋅c≡b⋅d(modn)

When a≡b(mod5) and c≡d(mod5), a⋅c≡b⋅d(mod5)

if 9≡4(mod5) and 7≡2(mod5)

then 9⋅7≡4⋅2(mod5)

63≡8(mod5)

63≡3(mod5)

Again, we reduce the right-hand side to a remainder less than 5: since 8≡3(mod5), we write 63≡3(mod5).

Fermat’s little theorem

ap−1≡1(modp)

Here, p is any prime number, and a is a positive integer.

  • The theorem applies when p is prime and a is not a multiple of p.
  • It says that if you raise a to the power p−1 and divide by p, the remainder is 1.

Example: The question below is from 2017 AMC 10B

An integerN is selected at random in the range 1≤N≤2020 . What is the probability that the remainder when N16 is divided by 5 is 1?
a. 51​
b. 52​
c. 53​
d. 54​
e. 1

(spoiler)

Answer: D. 54​

Notice that N16 can be rewritten as (N4)4. To connect this to Fermat’s little theorem, set p=5, so the exponent p−1 is 4. That’s why N4 is the key piece to analyze modulo 5.

Euler’s theorem

aϕ(n)≡1(modn)

Euler’s theorem is a generalization of Fermat’s little theorem.

  • For the theorem to apply, a and n must be coprime (they share no prime factors).
  • ϕ(n) is Euler’s totient function: it counts how many positive integers less than n are coprime to n.

For example, ϕ(10)=4 because there are 4 numbers less than 10 that are coprime to 10: 1, 3, 7, and 9.

Plugging in one of these coprimes gives:

74≡1(mod10)

In other words, the remainder of 2401 when divided by 10 is 1.

Example: The question below is from 2024 AMC 10B

How many different remainders can result when the100th power of an integer is divided by 125?
a. 1
b. 2
c. 5
d. 25
e. 125

(spoiler)

Answer: B. 2

Common themes

  • Any number mod 10 is just the last digit of the original number.
  • You can quickly determine if a number is 0(modx) if x is a factor of the original number.
  • Try the first few smaller exponents and look for a cycle, or repetition, in modular arithmetic questions that involve larger exponents.
  • Questions that involve clocks will likely involve the use of mod 12 (for each hour) or mod 60 (for each minute).

Modular arithmetic basics

  • Concerned with remainders after division
  • Notation: a≡b(modn) means a and b have same remainder when divided by n
  • Triple-bar ≡ denotes “congruent modulo”

Modular properties

  • Operations valid if moduli match:
    • Addition: a+c≡b+d(modn)
    • Subtraction: a−c≡b−d(modn)
    • Multiplication: a⋅c≡b⋅d(modn)
  • Always reduce right side to remainder less than modulus

Fermat’s little theorem

  • For prime p and a not divisible by p: ap−1≡1(modp)
  • Useful for simplifying large exponents modulo a prime

Euler’s theorem

  • For coprime a and n: aϕ(n)≡1(modn)
    • ϕ(n) = Euler’s totient function (counts numbers <n coprime to n)
  • Generalizes Fermat’s theorem to non-prime moduli

Common themes

  • Mod 10: remainder is last digit of number
  • x divides a ⟹ a≡0(modx)
  • Large exponents: look for cycles or repetition in remainders
  • Clock problems: use mod 12 (hours) or mod 60 (minutes)

Sign up for free to take 6 quiz questions on this topic

Previous
Next  | 4.1 Permutations and combinations
All rights reserved ©2016 - 2026 Achievable, Inc.

Modular arithmetic

This chapter applies to all AMC 8/10/12 test takers.

Modular arithmetic is about remainders in division. For example, when you divide 29 by 5, the remainder is 4. We write that as 29≡4(mod5).

The word “modular” comes from the Latin modulus, meaning a small measure. So 29≡4(mod5) is like saying: “If you measure 29 in chunks of 5, you have 4 left over.”

a≡b(modn)

The triple-bar equals sign means “congruent modulo.” The statement above reads: “a is congruent to b modulo n.” In practical terms, it means a and b leave the same remainder when divided by n.

Modular properties

Even though ≡ is not the same as =, you can still do many familiar algebra-like operations with congruences.

Here are three useful properties. For all three, assume:

  • a≡b(modn)
  • c≡d(modn)

In the examples, we’ll use a=9, b=4, c=7, d=2, and n=5, so:

9≡4(mod5) and 7≡2(mod5)

A key theme is that the modulus (the number after “mod”) must match. When two congruences share the same modulus, you can combine them using the operations below.

Addition

a+c≡b+d(modn)

When a≡b(mod5) and c≡d(mod5), a+c≡b+d(mod5)

if 9≡4(mod5) and 7≡2(mod5)

then 9+7≡4+2(mod5)

16≡6(mod5)

16≡1(mod5)

That last step is important. The number on the right side of ≡ is representing a remainder, so it should be written as a number less than the modulus. Since 6 is 1 more than 5, we replace 6 with 1.

Subtraction

a−c≡b−d(modn)

When a≡b(mod5) and c≡d(mod5), a−c≡b−d(mod5)

if 9≡4(mod5) and 7≡2(mod5)

then 9−7≡4−2(mod5)

2≡2(mod5)

Here, 2 is already less than 5, so no further simplification is needed.

This connects to a basic fact you’ll use often: x≡x(mody) when y>x.

Multiplication

a⋅c≡b⋅d(modn)

When a≡b(mod5) and c≡d(mod5), a⋅c≡b⋅d(mod5)

if 9≡4(mod5) and 7≡2(mod5)

then 9⋅7≡4⋅2(mod5)

63≡8(mod5)

63≡3(mod5)

Again, we reduce the right-hand side to a remainder less than 5: since 8≡3(mod5), we write 63≡3(mod5).

Fermat’s little theorem

ap−1≡1(modp)

Here, p is any prime number, and a is a positive integer.

  • The theorem applies when p is prime and a is not a multiple of p.
  • It says that if you raise a to the power p−1 and divide by p, the remainder is 1.

Example: The question below is from 2017 AMC 10B

An integerN is selected at random in the range 1≤N≤2020 . What is the probability that the remainder when N16 is divided by 5 is 1?
a. 51​
b. 52​
c. 53​
d. 54​
e. 1

(spoiler)

Answer: D. 54​

Notice that N16 can be rewritten as (N4)4. To connect this to Fermat’s little theorem, set p=5, so the exponent p−1 is 4. That’s why N4 is the key piece to analyze modulo 5.

Euler’s theorem

aϕ(n)≡1(modn)

Euler’s theorem is a generalization of Fermat’s little theorem.

  • For the theorem to apply, a and n must be coprime (they share no prime factors).
  • ϕ(n) is Euler’s totient function: it counts how many positive integers less than n are coprime to n.

For example, ϕ(10)=4 because there are 4 numbers less than 10 that are coprime to 10: 1, 3, 7, and 9.

Plugging in one of these coprimes gives:

74≡1(mod10)

In other words, the remainder of 2401 when divided by 10 is 1.

Example: The question below is from 2024 AMC 10B

How many different remainders can result when the100th power of an integer is divided by 125?
a. 1
b. 2
c. 5
d. 25
e. 125

(spoiler)

Answer: B. 2

Common themes

  • Any number mod 10 is just the last digit of the original number.
  • You can quickly determine if a number is 0(modx) if x is a factor of the original number.
  • Try the first few smaller exponents and look for a cycle, or repetition, in modular arithmetic questions that involve larger exponents.
  • Questions that involve clocks will likely involve the use of mod 12 (for each hour) or mod 60 (for each minute).
Key points

Modular arithmetic basics

  • Concerned with remainders after division
  • Notation: a≡b(modn) means a and b have same remainder when divided by n
  • Triple-bar ≡ denotes “congruent modulo”

Modular properties

  • Operations valid if moduli match:
    • Addition: a+c≡b+d(modn)
    • Subtraction: a−c≡b−d(modn)
    • Multiplication: a⋅c≡b⋅d(modn)
  • Always reduce right side to remainder less than modulus

Fermat’s little theorem

  • For prime p and a not divisible by p: ap−1≡1(modp)
  • Useful for simplifying large exponents modulo a prime

Euler’s theorem

  • For coprime a and n: aϕ(n)≡1(modn)
    • ϕ(n) = Euler’s totient function (counts numbers <n coprime to n)
  • Generalizes Fermat’s theorem to non-prime moduli

Common themes

  • Mod 10: remainder is last digit of number
  • x divides a ⟹ a≡0(modx)
  • Large exponents: look for cycles or repetition in remainders
  • Clock problems: use mod 12 (hours) or mod 60 (minutes)

More from Number theory

  • Factors and multiples
  • Prime numbers