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
aqbr840=?·384+??=?·?+??=?·?+?

Find the least common multiple lcm(840, 384). Use Euclid’s algorithm for the gcd first.

a = 840b = 384
lcm(840, 384) =
2.Easy
aqbr108=?·42+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(108, 42).

a = 108b = 42
gcd(108, 42) =
3.Medium

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

a = 73n = 79
73−1 mod 79 =
4.Medium

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

a = 4n = 51
4−1 mod 51 =
5.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (851, 19)d = ?

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

p = 23q = 37e = 19
d =
6.Hard
61c = me​ mod n?m = cd​ mod nm(n, e) = (713, 17)d

Encrypt the message m = 61 with the RSA public key (n, e) = (713, 17). Find the ciphertext c.

n = 713e = 17m = 61
c =

Answer key

  1. 1. lcm(840, 384) = 13440
  2. 2. gcd(108, 42) = 6
  3. 3. 73−1 mod 79 = 13
  4. 4. 4−1 mod 51 = 13
  5. 5. d = 667
  6. 6. c = 309

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