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
01234567mod 8

Find (−50) mod 8, the remainder r with 0 ≤ r < 8.

a = −50n = 8
(−50) mod 8 =
2.Easy
012mod 3

Find (−43) mod 3, the remainder r with 0 ≤ r < 3.

a = −43n = 3
(−43) mod 3 =
3.Medium

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

a = 3n = 53
3−1 mod 53 =
4.Medium

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

a = 32n = 47
32−1 mod 47 =
5.Hard
mc = me​ mod n335m = cd​ mod n?(n, e) = (473, 19)d

An RSA key uses p = 11, q = 43 and e = 19. Decrypt the ciphertext c = 335: find the message m.

p = 11q = 43e = 19c = 335
m =
6.Hard
514c = me​ mod n?m = cd​ mod nm(n, e) = (799, 17)d

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

n = 799e = 17m = 514
c =

Answer key

  1. 1. (−50) mod 8 = 6
  2. 2. (−43) mod 3 = 2
  3. 3. 3−1 mod 53 = 18
  4. 4. 32−1 mod 47 = 25
  5. 5. m = 416
  6. 6. c = 327

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