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 (395·202) mod 6 without multiplying out the large numbers: reduce first.

n = 6
(395·202) mod 6 =
2.Easy
012345678mod 9

Find 921 mod 9, the remainder r with 0 ≤ r < 9.

a = 921n = 9
921 mod 9 =
3.Medium

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

a = 21n = 29
21−1 mod 29 =
4.Medium

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

a = 23n = 37
23−1 mod 37 =
5.Hard
19c = me​ mod n?m = cd​ mod nm(n, e) = (187, 11)d

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

n = 187e = 11m = 19
c =
6.Hard
mc = me​ mod n248m = cd​ mod n?(n, e) = (287, 13)d

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

p = 7q = 41e = 13c = 248
m =

Answer key

  1. 1. (395·202) mod 6 = 2
  2. 2. 921 mod 9 = 3
  3. 3. 21−1 mod 29 = 18
  4. 4. 23−1 mod 37 = 29
  5. 5. c = 8
  6. 6. m = 241

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