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
aqbr714=?·224+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(714, 224).

a = 714b = 224
gcd(714, 224) =
2.Easy
aqbr468=?·372+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(468, 372).

a = 468b = 372
gcd(468, 372) =
3.Medium

Solve 75x ≡ 1 (mod 79). Give the solution x with 0 < x < 79.

75x ≡ 1 (mod 79)
x =
4.Medium

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

a = 21n = 25
21−1 mod 25 =
5.Hard
21c = me​ mod n?m = cd​ mod nm(n, e) = (235, 7)d

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

n = 235e = 7m = 21
c =
6.Hard
mc = me​ mod n173m = cd​ mod n?(n, e) = (217, 13)d

An RSA key uses p = 7, q = 31 and e = 13. Decrypt the ciphertext c = 173: find the message m.

p = 7q = 31e = 13c = 173
m =

Answer key

  1. 1. gcd(714, 224) = 14
  2. 2. gcd(468, 372) = 12
  3. 3. x = 59
  4. 4. 21−1 mod 25 = 6
  5. 5. c = 131
  6. 6. m = 40

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