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
aqbr392=?·184+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(392, 184).

a = 392b = 184
gcd(392, 184) =
2.Easy
01234567mod 8

Find 119 mod 8, the remainder r with 0 ≤ r < 8.

a = 119n = 8
119 mod 8 =
3.Medium

Solve 38x ≡ 54 (mod 89). Give the solution x with 0 < x < 89.

38x ≡ 54 (mod 89)
x =
4.Medium

Find the smallest positive integer x with x ≡ 3 (mod 7) and x ≡ 2 (mod 11).

x ≡ 3 (mod 7)x ≡ 2 (mod 11)
x =
5.Hard
453c = me​ mod n?m = cd​ mod nm(n, e) = (527, 23)d

Encrypt the message m = 453 with the RSA public key (n, e) = (527, 23). Find the ciphertext c.

n = 527e = 23m = 453
c =
6.Hard

37 is prime. Use Fermat’s little theorem to find 125588 mod 37.

p = 37k = 5588
125588 mod 37 =

Answer key

  1. 1. gcd(392, 184) = 8
  2. 2. 119 mod 8 = 7
  3. 3. x = 67
  4. 4. x = 24
  5. 5. c = 71
  6. 6. 125588 mod 37 = 34

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