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
aqbr627=?·286+??=?·?+??=?·?+?

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

a = 627b = 286
lcm(627, 286) =
2.Easy
aqbr468=?·279+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(468, 279).

a = 468b = 279
gcd(468, 279) =
3.Medium

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

a = 22n = 59
22−1 mod 59 =
4.Medium

Solve 35x ≡ 3 (mod 67). Give the solution x with 0 < x < 67.

35x ≡ 3 (mod 67)
x =
5.Hard
mc = me​ mod n1432m = cd​ mod n?(n, e) = (1591, 17)d

An RSA key uses p = 37, q = 43 and e = 17. Decrypt the ciphertext c = 1432: find the message m.

p = 37q = 43e = 17c = 1432
m =
6.Hard
mc = me​ mod n138m = cd​ mod n?(n, e) = (185, 7)d

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

p = 5q = 37e = 7c = 138
m =

Answer key

  1. 1. lcm(627, 286) = 16302
  2. 2. gcd(468, 279) = 9
  3. 3. 22−1 mod 59 = 51
  4. 4. x = 2
  5. 5. m = 676
  6. 6. m = 27

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