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
aqbr369=?·279+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(369, 279).

a = 369b = 279
gcd(369, 279) =
2.Easy
01234mod 5

Find (−9) mod 5, the remainder r with 0 ≤ r < 5.

a = −9n = 5
(−9) mod 5 =
3.Medium

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

a = 43n = 65
43−1 mod 65 =
4.Medium

Find the smallest positive integer x with x ≡ 5 (mod 6) and x ≡ 6 (mod 7).

x ≡ 5 (mod 6)x ≡ 6 (mod 7)
x =
5.Hard
5c = me​ mod n?m = cd​ mod nm(n, e) = (119, 19)d

Encrypt the message m = 5 with the RSA public key (n, e) = (119, 19). Find the ciphertext c.

n = 119e = 19m = 5
c =
6.Hard

Use repeated squaring to find 687 mod 41.

a = 6k = 87n = 41
687 mod 41 =

Answer key

  1. 1. gcd(369, 279) = 9
  2. 2. (−9) mod 5 = 1
  3. 3. 43−1 mod 65 = 62
  4. 4. x = 41
  5. 5. c = 40
  6. 6. 687 mod 41 = 29

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