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
aqbr341=?·187+??=?·?+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(341, 187).

a = 341b = 187
gcd(341, 187) =
2.Easy
0123456mod 7

Find (−102) mod 7, the remainder r with 0 ≤ r < 7.

a = −102n = 7
(−102) mod 7 =
3.Medium

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

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

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

n = 125 = 53
φ(125) =
5.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (221, 5)d = ?

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

p = 13q = 17e = 5
d =
6.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (817, 5)d = ?

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

p = 19q = 43e = 5
d =

Answer key

  1. 1. gcd(341, 187) = 11
  2. 2. (−102) mod 7 = 3
  3. 3. 52−1 mod 59 = 42
  4. 4. φ(125) = 100
  5. 5. d = 77
  6. 6. d = 605

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