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
012345mod 6

Find 424 mod 6, the remainder r with 0 ≤ r < 6.

a = 424n = 6
424 mod 6 =
2.Easy
aqbr70=?·32+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(70, 32).

a = 70b = 32
gcd(70, 32) =
3.Medium

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

a = 17n = 41
17−1 mod 41 =
4.Medium

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

a = 20n = 59
20−1 mod 59 =
5.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (145, 17)d = ?

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

p = 5q = 29e = 17
d =
6.Hard
128c = me​ mod n?m = cd​ mod nm(n, e) = (185, 13)d

Encrypt the message m = 128 with the RSA public key (n, e) = (185, 13). Find the ciphertext c.

n = 185e = 13m = 128
c =

Answer key

  1. 1. 424 mod 6 = 4
  2. 2. gcd(70, 32) = 2
  3. 3. 17−1 mod 41 = 29
  4. 4. 20−1 mod 59 = 3
  5. 5. d = 33
  6. 6. c = 183

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