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

Find (577·334 + 48) mod 12 without multiplying out the large numbers: reduce first.

n = 12
(577·334 + 48) mod 12 =
2.Easy
aqbr116=?·98+??=?·?+??=?·?+??=?·?+?

Find the least common multiple lcm(116, 98). Use Euclid’s algorithm for the gcd first.

a = 116b = 98
lcm(116, 98) =
3.Medium

Solve 13x ≡ 18 (mod 31). Give the solution x with 0 < x < 31.

13x ≡ 18 (mod 31)
x =
4.Medium

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

a = 9n = 31
9−1 mod 31 =
5.Hard
57c = me​ mod n?m = cd​ mod nm(n, e) = (341, 7)d

Encrypt the message m = 57 with the RSA public key (n, e) = (341, 7). Find the ciphertext c.

n = 341e = 7m = 57
c =
6.Hard
mc = me​ mod n1273m = cd​ mod n?(n, e) = (1333, 13)d

An RSA key uses p = 31, q = 43 and e = 13. Decrypt the ciphertext c = 1273: find the message m.

p = 31q = 43e = 13c = 1273
m =

Answer key

  1. 1. (577·334 + 48) mod 12 = 10
  2. 2. lcm(116, 98) = 5684
  3. 3. x = 30
  4. 4. 9−1 mod 31 = 7
  5. 5. c = 150
  6. 6. m = 159

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