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
0123456mod 7

Find (−108) mod 7, the remainder r with 0 ≤ r < 7.

a = −108n = 7
(−108) mod 7 =
2.Easy

Find 171² mod 6 without multiplying out the large numbers: reduce first.

n = 6
171² mod 6 =
3.Medium

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

a = 47n = 61
47−1 mod 61 =
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

97 is prime. Use Fermat’s little theorem to find 2969560 mod 97.

p = 97k = 69560
2969560 mod 97 =
6.Hard
677c = me​ mod n?m = cd​ mod nm(n, e) = (1189, 23)d

Encrypt the message m = 677 with the RSA public key (n, e) = (1189, 23). Find the ciphertext c.

n = 1189e = 23m = 677
c =

Answer key

  1. 1. (−108) mod 7 = 4
  2. 2. 171² mod 6 = 3
  3. 3. 47−1 mod 61 = 13
  4. 4. 9−1 mod 11 = 5
  5. 5. 2969560 mod 97 = 91
  6. 6. c = 446

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