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
aqbr434=?·168+??=?·?+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(434, 168).

a = 434b = 168
gcd(434, 168) =
2.Easy
0123456mod 7

Find (−24) mod 7, the remainder r with 0 ≤ r < 7.

a = −24n = 7
(−24) mod 7 =
3.Medium

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

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

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

a = 41n = 67
41−1 mod 67 =
5.Hard

Use repeated squaring to find 5393 mod 60.

a = 53k = 93n = 60
5393 mod 60 =
6.Hard
341c = me​ mod n?m = cd​ mod nm(n, e) = (377, 19)d

Encrypt the message m = 341 with the RSA public key (n, e) = (377, 19). Find the ciphertext c.

n = 377e = 19m = 341
c =

Answer key

  1. 1. gcd(434, 168) = 14
  2. 2. (−24) mod 7 = 4
  3. 3. 5−1 mod 67 = 27
  4. 4. 41−1 mod 67 = 18
  5. 5. 5393 mod 60 = 53
  6. 6. c = 42

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