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
aqbr693=?·147+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(693, 147).

a = 693b = 147
gcd(693, 147) =
2.Easy
aqbr136=?·92+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(136, 92).

a = 136b = 92
gcd(136, 92) =
3.Medium

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

a = 68n = 83
68−1 mod 83 =
4.Medium

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

a = 15n = 29
15−1 mod 29 =
5.Hard
mc = me​ mod n321m = cd​ mod n?(n, e) = (799, 11)d

An RSA key uses p = 17, q = 47 and e = 11. Decrypt the ciphertext c = 321: find the message m.

p = 17q = 47e = 11c = 321
m =
6.Hard

Use repeated squaring to find 55161 mod 58.

a = 55k = 161n = 58
55161 mod 58 =

Answer key

  1. 1. gcd(693, 147) = 21
  2. 2. gcd(136, 92) = 4
  3. 3. 68−1 mod 83 = 11
  4. 4. 15−1 mod 29 = 2
  5. 5. m = 434
  6. 6. 55161 mod 58 = 41

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