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
aqbr216=?·32+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(216, 32).

a = 216b = 32
gcd(216, 32) =
2.Easy
0123456mod 7

Find 495 mod 7, the remainder r with 0 ≤ r < 7.

a = 495n = 7
495 mod 7 =
3.Medium

Solve 46x ≡ 68 (mod 97). Give the solution x with 0 < x < 97.

46x ≡ 68 (mod 97)
x =
4.Medium

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

a = 59n = 80
59−1 mod 80 =
5.Hard
386c = me​ mod n?m = cd​ mod nm(n, e) = (517, 11)d

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

n = 517e = 11m = 386
c =
6.Hard

How many solutions N does 21x ≡ 27 (mod 30) have in {0, 1, …, 29}?

21x ≡ 27 (mod 30)
N =

Answer key

  1. 1. gcd(216, 32) = 8
  2. 2. 495 mod 7 = 5
  3. 3. x = 31
  4. 4. 59−1 mod 80 = 19
  5. 5. c = 210
  6. 6. N = 3

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