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
aqbr624=?·516+??=?·?+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(624, 516).

a = 624b = 516
gcd(624, 516) =
2.Easy
aqbr236=?·16+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(236, 16).

a = 236b = 16
gcd(236, 16) =
3.Medium

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

a = 38n = 47
38−1 mod 47 =
4.Medium

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

n = 49 = 72
φ(49) =
5.Hard

Use repeated squaring to find 4347 mod 64.

a = 43k = 47n = 64
4347 mod 64 =
6.Hard
mc = me​ mod n308m = cd​ mod n?(n, e) = (1147, 7)d

An RSA key uses p = 31, q = 37 and e = 7. Decrypt the ciphertext c = 308: find the message m.

p = 31q = 37e = 7c = 308
m =

Answer key

  1. 1. gcd(624, 516) = 12
  2. 2. gcd(236, 16) = 4
  3. 3. 38−1 mod 47 = 26
  4. 4. φ(49) = 42
  5. 5. 4347 mod 64 = 3
  6. 6. m = 1015

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