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
aqbr945=?·357+??=?·?+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(945, 357).

a = 945b = 357
gcd(945, 357) =
2.Easy
0123456789mod 10

Find (−147) mod 10, the remainder r with 0 ≤ r < 10.

a = −147n = 10
(−147) mod 10 =
3.Medium

Find the smallest positive integer x with x ≡ 8 (mod 10) and x ≡ 7 (mod 13).

x ≡ 8 (mod 10)x ≡ 7 (mod 13)
x =
4.Medium

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

n = 1125 = 32·53
φ(1125) =
5.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (1271, 13)d = ?

An RSA key uses the primes p = 31 and q = 41 and the public exponent e = 13. Find the private exponent d (0 < d < φ(n)).

p = 31q = 41e = 13
d =
6.Hard
106c = me​ mod n?m = cd​ mod nm(n, e) = (155, 7)d

Encrypt the message m = 106 with the RSA public key (n, e) = (155, 7). Find the ciphertext c.

n = 155e = 7m = 106
c =

Answer key

  1. 1. gcd(945, 357) = 21
  2. 2. (−147) mod 10 = 3
  3. 3. x = 98
  4. 4. φ(1125) = 600
  5. 5. d = 277
  6. 6. c = 146

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