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
aqbr322=?·91+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(322, 91).

a = 322b = 91
gcd(322, 91) =
2.Easy
aqbr160=?·88+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(160, 88).

a = 160b = 88
gcd(160, 88) =
3.Medium

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

a = 20n = 73
20−1 mod 73 =
4.Medium

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

a = 9n = 11
9−1 mod 11 =
5.Hard

Use repeated squaring to find 2367 mod 41.

a = 23k = 67n = 41
2367 mod 41 =
6.Hard
21c = me​ mod n?m = cd​ mod nm(n, e) = (155, 17)d

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

n = 155e = 17m = 21
c =

Answer key

  1. 1. gcd(322, 91) = 7
  2. 2. gcd(160, 88) = 8
  3. 3. 20−1 mod 73 = 11
  4. 4. 9−1 mod 11 = 5
  5. 5. 2367 mod 41 = 4
  6. 6. c = 86

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