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 (−145) mod 7, the remainder r with 0 ≤ r < 7.

a = −145n = 7
(−145) mod 7 =
2.Easy
aqbr384=?·84+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(384, 84).

a = 384b = 84
gcd(384, 84) =
3.Medium

Find Euler’s totient φ(27), the number of integers from 1 to 27 that are coprime to 27.

n = 27 = 33
φ(27) =
4.Medium

Solve 41x ≡ 67 (mod 95). Give the solution x with 0 < x < 95.

41x ≡ 67 (mod 95)
x =
5.Hard

Use repeated squaring to find 3975 mod 50.

a = 39k = 75n = 50
3975 mod 50 =
6.Hard
mc = me​ mod n14m = cd​ mod n?(n, e) = (55, 3)d

An RSA key uses p = 5, q = 11 and e = 3. Decrypt the ciphertext c = 14: find the message m.

p = 5q = 11e = 3c = 14
m =

Answer key

  1. 1. (−145) mod 7 = 2
  2. 2. gcd(384, 84) = 12
  3. 3. φ(27) = 18
  4. 4. x = 92
  5. 5. 3975 mod 50 = 49
  6. 6. m = 9

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