Find (−77) mod 8, the remainder r with 0 ≤ r < 8.
Number theory & modular arithmetic worksheet with answers
1.Easy
a = −77n = 8
(−77) mod 8 =
2.Easy
Find the least common multiple lcm(406, 336). Use Euclid’s algorithm for the gcd first.
a = 406b = 336
lcm(406, 336) =
3.Medium
Find the inverse of 27 modulo 89: the number x with 0 < x < 89 and 27·x ≡ 1 (mod 89).
a = 27n = 89
27−1 mod 89 =
4.Medium
Find the inverse of 72 modulo 79: the number x with 0 < x < 79 and 72·x ≡ 1 (mod 79).
a = 72n = 79
72−1 mod 79 =
5.Hard
An RSA key uses p = 7, q = 31 and e = 17. Decrypt the ciphertext c = 39: find the message m.
p = 7q = 31e = 17c = 39
m =
6.Hard
Encrypt the message m = 87 with the RSA public key (n, e) = (533, 13). Find the ciphertext c.
n = 533e = 13m = 87
c =
Answer key
- 1. (−77) mod 8 = 3
- 2. lcm(406, 336) = 9744
- 3. 27−1 mod 89 = 33
- 4. 72−1 mod 79 = 45
- 5. m = 16
- 6. c = 490
Full step-by-step solutions: practise this topic on examproblems.com.