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
012345678mod 9

Find (−77) mod 9, the remainder r with 0 ≤ r < 9.

a = −77n = 9
(−77) mod 9 =
2.Easy
aqbr472=?·208+??=?·?+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(472, 208).

a = 472b = 208
gcd(472, 208) =
3.Medium

Find the smallest positive integer x with x ≡ 1 (mod 5) and x ≡ 4 (mod 6).

x ≡ 1 (mod 5)x ≡ 4 (mod 6)
x =
4.Medium

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

n = 169 = 132
φ(169) =
5.Hard
mc = me​ mod n1192m = cd​ mod n?(n, e) = (1517, 23)d

An RSA key uses p = 37, q = 41 and e = 23. Decrypt the ciphertext c = 1192: find the message m.

p = 37q = 41e = 23c = 1192
m =
6.Hard
mc = me​ mod n834m = cd​ mod n?(n, e) = (1081, 7)d

An RSA key uses p = 23, q = 47 and e = 7. Decrypt the ciphertext c = 834: find the message m.

p = 23q = 47e = 7c = 834
m =

Answer key

  1. 1. (−77) mod 9 = 4
  2. 2. gcd(472, 208) = 8
  3. 3. x = 16
  4. 4. φ(169) = 156
  5. 5. m = 14
  6. 6. m = 133

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