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

Find (116·403 + 399) mod 6 without multiplying out the large numbers: reduce first.

n = 6
(116·403 + 399) mod 6 =
2.Easy
aqbr555=?·495+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(555, 495).

a = 555b = 495
gcd(555, 495) =
3.Medium

Solve 37x ≡ 31 (mod 95). Give the solution x with 0 < x < 95.

37x ≡ 31 (mod 95)
x =
4.Medium

Solve 27x ≡ 79 (mod 83). Give the solution x with 0 < x < 83.

27x ≡ 79 (mod 83)
x =
5.Hard
mc = me​ mod n169m = cd​ mod n?(n, e) = (527, 17)d

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

p = 17q = 31e = 17c = 169
m =
6.Hard
121c = me​ mod n?m = cd​ mod nm(n, e) = (1271, 11)d

Encrypt the message m = 121 with the RSA public key (n, e) = (1271, 11). Find the ciphertext c.

n = 1271e = 11m = 121
c =

Answer key

  1. 1. (116·403 + 399) mod 6 = 5
  2. 2. gcd(555, 495) = 15
  3. 3. x = 83
  4. 4. x = 6
  5. 5. m = 390
  6. 6. c = 576

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