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
aqbr885=?·255+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(885, 255).

a = 885b = 255
gcd(885, 255) =
2.Easy
aqbr132=?·52+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(132, 52).

a = 132b = 52
gcd(132, 52) =
3.Medium

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

n = 52 = 22·13
φ(52) =
4.Medium

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

a = 28n = 31
28−1 mod 31 =
5.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (713, 23)d = ?

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

p = 23q = 31e = 23
d =
6.Hard

How many solutions N does 64x ≡ 32 (mod 90) have in {0, 1, …, 89}?

64x ≡ 32 (mod 90)
N =

Answer key

  1. 1. gcd(885, 255) = 15
  2. 2. gcd(132, 52) = 4
  3. 3. φ(52) = 24
  4. 4. 28−1 mod 31 = 10
  5. 5. d = 287
  6. 6. N = 2

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