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
012345678mod 9

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

a = −16n = 9
(−16) mod 9 =
2.Easy
aqbr392=?·376+??=?·?+??=?·?+?

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

a = 392b = 376
gcd(392, 376) =
3.Medium

Find Euler’s totient φ(637), the number of integers from 1 to 637 that are coprime to 637.

n = 637 = 72·13
φ(637) =
4.Medium

Solve 25x ≡ 34 (mod 94). Give the solution x with 0 < x < 94.

25x ≡ 34 (mod 94)
x =
5.Hard
558c = me​ mod n?m = cd​ mod nm(n, e) = (2021, 17)d

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

n = 2021e = 17m = 558
c =
6.Hard
167c = me​ mod n?m = cd​ mod nm(n, e) = (517, 3)d

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

n = 517e = 3m = 167
c =

Answer key

  1. 1. (−16) mod 9 = 2
  2. 2. gcd(392, 376) = 8
  3. 3. φ(637) = 504
  4. 4. x = 54
  5. 5. c = 257
  6. 6. c = 327

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