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
aqbr414=?·369+??=?·?+??=?·?+?

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

a = 414b = 369
gcd(414, 369) =
2.Easy
01234567mod 8

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

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

Find the smallest positive integer x with x ≡ 4 (mod 7) and x ≡ 0 (mod 13).

x ≡ 4 (mod 7)x ≡ 0 (mod 13)
x =
4.Medium

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

n = 578 = 2·172
φ(578) =
5.Hard
87c = me​ mod n?m = cd​ mod nm(n, e) = (1081, 13)d

Encrypt the message m = 87 with the RSA public key (n, e) = (1081, 13). Find the ciphertext c.

n = 1081e = 13m = 87
c =
6.Hard

Use repeated squaring to find 9136 mod 99.

a = 91k = 36n = 99
9136 mod 99 =

Answer key

  1. 1. gcd(414, 369) = 9
  2. 2. 222 mod 8 = 6
  3. 3. x = 39
  4. 4. φ(578) = 272
  5. 5. c = 163
  6. 6. 9136 mod 99 = 91

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