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

Find 416² mod 5 without multiplying out the large numbers: reduce first.

n = 5
416² mod 5 =
2.Easy
aqbr224=?·124+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(224, 124).

a = 224b = 124
gcd(224, 124) =
3.Medium

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

n = 34 = 2·17
φ(34) =
4.Medium

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

a = 19n = 83
19−1 mod 83 =
5.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (217, 17)d = ?

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

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

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

p = 13q = 29e = 13
d =

Answer key

  1. 1. 416² mod 5 = 1
  2. 2. gcd(224, 124) = 4
  3. 3. φ(34) = 16
  4. 4. 19−1 mod 83 = 35
  5. 5. d = 53
  6. 6. d = 181

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