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
aqbr112=?·102+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(112, 102).

a = 112b = 102
gcd(112, 102) =
2.Easy
01234mod 5

Find (−107) mod 5, the remainder r with 0 ≤ r < 5.

a = −107n = 5
(−107) mod 5 =
3.Medium

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

a = 63n = 67
63−1 mod 67 =
4.Medium

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

a = 19n = 43
19−1 mod 43 =
5.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (703, 11)d = ?

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

p = 19q = 37e = 11
d =
6.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (851, 19)d = ?

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

p = 23q = 37e = 19
d =

Answer key

  1. 1. gcd(112, 102) = 2
  2. 2. (−107) mod 5 = 3
  3. 3. 63−1 mod 67 = 50
  4. 4. 19−1 mod 43 = 34
  5. 5. d = 59
  6. 6. d = 667

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