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
01234mod 5

Find (−146) mod 5, the remainder r with 0 ≤ r < 5.

a = −146n = 5
(−146) mod 5 =
2.Easy
0123456mod 7

Find 193 mod 7, the remainder r with 0 ≤ r < 7.

a = 193n = 7
193 mod 7 =
3.Medium

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

n = 475 = 52·19
φ(475) =
4.Medium

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

a = 4n = 19
4−1 mod 19 =
5.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (629, 13)d = ?

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

p = 17q = 37e = 13
d =
6.Hard

Solve 16x ≡ 14 (mod 38). Give the smallest positive solution x.

16x ≡ 14 (mod 38)
x =

Answer key

  1. 1. (−146) mod 5 = 4
  2. 2. 193 mod 7 = 4
  3. 3. φ(475) = 360
  4. 4. 4−1 mod 19 = 5
  5. 5. d = 133
  6. 6. x = 8

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