Number theory & modular arithmetic worksheet with answers

Free printable Number theory & modular arithmetic worksheet: 6 problems from easy to exam level, with an answer key. Print it or save it as a PDF.

For teachers: free to print, copy and use in class. Every new worksheet has new values and its own answer key. A link to ExamProblems on your course page is appreciated.

Name: ____________________   Date: ____________

1.Easy
01234567891011mod 12

Find 431 mod 12, the remainder r with 0 ≤ r < 12.

a = 431n = 12
431 mod 12 =
2.Easy
aqbr192=?·162+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(192, 162).

a = 192b = 162
gcd(192, 162) =
3.Medium

Find the inverse of 7 modulo 30: the number x with 0 < x < 30 and 7·x ≡ 1 (mod 30).

a = 7n = 30
7−1 mod 30 =
4.Medium

Find the smallest positive integer x with x ≡ 1 (mod 4) and x ≡ 2 (mod 5).

x ≡ 1 (mod 4)x ≡ 2 (mod 5)
x =
5.Hard

Solve 56x ≡ 8 (mod 80). Give the smallest positive solution x.

56x ≡ 8 (mod 80)
x =
6.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (589, 23)d = ?

An RSA key uses the primes p = 19 and q = 31 and the public exponent e = 23. Find the private exponent d (0 < d < φ(n)).

p = 19q = 31e = 23
d =

Answer key

  1. 1. 431 mod 12 = 11
  2. 2. gcd(192, 162) = 6
  3. 3. 7−1 mod 30 = 13
  4. 4. x = 17
  5. 5. x = 3
  6. 6. d = 47

Full step-by-step solutions: practise this topic on examproblems.com.