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 788 mod 9, the remainder r with 0 ≤ r < 9.

a = 788n = 9
788 mod 9 =
2.Easy
aqbr473=?·176+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(473, 176).

a = 473b = 176
gcd(473, 176) =
3.Medium

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

a = 45n = 59
45−1 mod 59 =
4.Medium

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

a = 5n = 13
5−1 mod 13 =
5.Hard

Use repeated squaring to find 27137 mod 37.

a = 27k = 137n = 37
27137 mod 37 =
6.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (155, 7)d = ?

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

p = 5q = 31e = 7
d =

Answer key

  1. 1. 788 mod 9 = 5
  2. 2. gcd(473, 176) = 11
  3. 3. 45−1 mod 59 = 21
  4. 4. 5−1 mod 13 = 8
  5. 5. 27137 mod 37 = 11
  6. 6. d = 103

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