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
012345678mod 9

Find 160 mod 9, the remainder r with 0 ≤ r < 9.

a = 160n = 9
160 mod 9 =
2.Easy
aqbr385=?·273+??=?·?+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(385, 273).

a = 385b = 273
gcd(385, 273) =
3.Medium

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

a = 35n = 83
35−1 mod 83 =
4.Medium

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

a = 29n = 61
29−1 mod 61 =
5.Hard
223c = me​ mod n?m = cd​ mod nm(n, e) = (247, 17)d

Encrypt the message m = 223 with the RSA public key (n, e) = (247, 17). Find the ciphertext c.

n = 247e = 17m = 223
c =
6.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (143, 23)d = ?

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

p = 11q = 13e = 23
d =

Answer key

  1. 1. 160 mod 9 = 7
  2. 2. gcd(385, 273) = 7
  3. 3. 35−1 mod 83 = 19
  4. 4. 29−1 mod 61 = 40
  5. 5. c = 110
  6. 6. d = 47

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