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
aqbr663=?·494+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(663, 494).

a = 663b = 494
gcd(663, 494) =
2.Easy
aqbr342=?·243+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(342, 243).

a = 342b = 243
gcd(342, 243) =
3.Medium

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

a = 25n = 34
25−1 mod 34 =
4.Medium

Solve 27x ≡ 56 (mod 71). Give the solution x with 0 < x < 71.

27x ≡ 56 (mod 71)
x =
5.Hard
179c = me​ mod n?m = cd​ mod nm(n, e) = (209, 11)d

Encrypt the message m = 179 with the RSA public key (n, e) = (209, 11). Find the ciphertext c.

n = 209e = 11m = 179
c =
6.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (203, 23)d = ?

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

p = 7q = 29e = 23
d =

Answer key

  1. 1. gcd(663, 494) = 13
  2. 2. gcd(342, 243) = 9
  3. 3. 25−1 mod 34 = 15
  4. 4. x = 31
  5. 5. c = 69
  6. 6. d = 95

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