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
aqbr585=?·255+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(585, 255).

a = 585b = 255
gcd(585, 255) =
2.Easy
0123456mod 7

Find (−18) mod 7, the remainder r with 0 ≤ r < 7.

a = −18n = 7
(−18) mod 7 =
3.Medium

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

n = 363 = 3·112
φ(363) =
4.Medium

Solve 47x ≡ 70 (mod 77). Give the solution x with 0 < x < 77.

47x ≡ 70 (mod 77)
x =
5.Hard
225c = me​ mod n?m = cd​ mod nm(n, e) = (319, 3)d

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

n = 319e = 3m = 225
c =
6.Hard

Use repeated squaring to find 2967 mod 80.

a = 29k = 67n = 80
2967 mod 80 =

Answer key

  1. 1. gcd(585, 255) = 15
  2. 2. (−18) mod 7 = 3
  3. 3. φ(363) = 220
  4. 4. x = 49
  5. 5. c = 92
  6. 6. 2967 mod 80 = 69

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