Modular Arithmetic Practice Questions

Last Updated : 8 Jul, 2026

Modular arithmetic is a method of performing arithmetic where numbers wrap around after reaching a fixed value called the modulus. Instead of the quotient, it focuses only on the remainder.

Example: 13 mod 5 = 3 because when 13 is divided by 5, the remainder is 3.

Question 1: Show that 38 ≡ 14 (mod 12)

Solution:

38 = 3 × 12 + 2
14 = 1 × 12 + 2

Both 38 and 14 have the same remainder (2) when divided by 12.

Therefore, 38 ≡ 14 (mod 12)

Question 2: Compute (27 + 19) mod 7

Solution:

27 ≡ 6 (mod 7) because 27 = 3 × 7 + 6
19 ≡ 5 (mod 7) because 19 = 2 × 7 + 5
(27 + 19) mod 7 ≡ (6 + 5) mod 7 ≡ 11 mod 7 ≡ 4

Question 3: Compute (23 × 17) mod 5

Solution:

23 ≡ 3 (mod 5) because 23 = 4 × 5 + 3
17 ≡ 2 (mod 5) because 17 = 3 × 5 + 2
(23 × 17) mod 5 ≡ (3 × 2) mod 5 ≡ 6 mod 5 ≡ 1

Question 4: Compute 7100 mod 11

Solution:

Use Euler's theorem: a^φ(n) ≡ 1 (mod n) for coprime a and n

φ(11) = 10 (Euler's totient function for prime 11)
7^100 ≡ 7^(10 × 10) ≡ (7^10)^10 ≡ 1^10 ≡ 1 (mod 11)

Example 5: Solve 5x ≡ 3 (mod 7)

Solution:

Multiply both sides by 3 (modular multiplicative inverse of 5 mod 7):

3 × 5x ≡ 3 × 3 (mod 7)
15x ≡ 9 (mod 7)
x ≡ 2 (mod 7)

Question 6: Solve the system of congruences:

  • x ≡ 2 (mod 3)
  • x ≡ 3 (mod 5)
  • x ≡ 2 (mod 7)

Solution:

M = 3 × 5 × 7 = 105

M1 = 105/3 = 35, y1 = 35^(-1) mod 3 = 2
M2 = 105/5 = 21, y2 = 21^(-1) mod 5 = 1
M3 = 105/7 = 15, y3 = 15^(-1) mod 7 = 1

x = (2 × 35 × 2 + 3 × 21 × 1 + 2 × 15 × 1) mod 105
= (140 + 63 + 30) mod 105
= 233 mod 105
= 23

Verify: 23 ≡ 2 (mod 3), 23 ≡ 3 (mod 5), 23 ≡ 2 (mod 7)

Practice Problems

1. Calculate 47 mod 7.

2. Solve the linear congruence: 5x ≡ 3 (mod 8)

3. Find the modular multiplicative inverse of 5 modulo 11.

4. Using Fermat's Little Theorem, calculate 7100 mod 11.

5. Solve the system of congruences:

  • x ≡ 2 (mod 3)
  • x ≡ 3 (mod 5)
  • x ≡ 4 (mod 7)

6. Determine whether 29 is prime using Wilson's Theorem.

7. Calculate (17 × 23 + 31) mod 13.

8. Solve the congruence: x2 ≡ 4 (mod 11)

Comment

Explore