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

Find (471·158 + 74) mod 8 without multiplying out the large numbers: reduce first.

n = 8
(471·158 + 74) mod 8 =
2.Easy
0123456789mod 10

Find (−11) mod 10, the remainder r with 0 ≤ r < 10.

a = −11n = 10
(−11) mod 10 =
3.Medium

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

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

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

a = 5n = 74
5−1 mod 74 =
5.Hard
304c = me​ mod n?m = cd​ mod nm(n, e) = (1147, 7)d

Encrypt the message m = 304 with the RSA public key (n, e) = (1147, 7). Find the ciphertext c.

n = 1147e = 7m = 304
c =
6.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (1147, 17)d = ?

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

p = 31q = 37e = 17
d =

Answer key

  1. 1. (471·158 + 74) mod 8 = 4
  2. 2. (−11) mod 10 = 9
  3. 3. 58−1 mod 67 = 52
  4. 4. 5−1 mod 74 = 15
  5. 5. c = 769
  6. 6. d = 953

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