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
aqbr987=?·651+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(987, 651).

a = 987b = 651
gcd(987, 651) =
2.Easy

Find (365·674 + 314) mod 9 without multiplying out the large numbers: reduce first.

n = 9
(365·674 + 314) mod 9 =
3.Medium

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

a = 19n = 31
19−1 mod 31 =
4.Medium

Find the smallest positive integer x with x ≡ 1 (mod 3) and x ≡ 2 (mod 8).

x ≡ 1 (mod 3)x ≡ 2 (mod 8)
x =
5.Hard
mc = me​ mod n977m = cd​ mod n?(n, e) = (1517, 19)d

An RSA key uses p = 37, q = 41 and e = 19. Decrypt the ciphertext c = 977: find the message m.

p = 37q = 41e = 19c = 977
m =
6.Hard

Use repeated squaring to find 13175 mod 31.

a = 13k = 175n = 31
13175 mod 31 =

Answer key

  1. 1. gcd(987, 651) = 21
  2. 2. (365·674 + 314) mod 9 = 3
  3. 3. 19−1 mod 31 = 18
  4. 4. x = 10
  5. 5. m = 170
  6. 6. 13175 mod 31 = 26

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