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
aqbr1218=?·567+??=?·?+??=?·?+??=?·?+?

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

a = 1218b = 567
lcm(1218, 567) =
2.Easy
aqbr58=?·46+??=?·?+??=?·?+??=?·?+?

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

a = 58b = 46
lcm(58, 46) =
3.Medium

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

a = 21n = 95
21−1 mod 95 =
4.Medium

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

a = 37n = 62
37−1 mod 62 =
5.Hard

Use repeated squaring to find 18160 mod 47.

a = 18k = 160n = 47
18160 mod 47 =
6.Hard
mc = me​ mod n129m = cd​ mod n?(n, e) = (133, 17)d

An RSA key uses p = 7, q = 19 and e = 17. Decrypt the ciphertext c = 129: find the message m.

p = 7q = 19e = 17c = 129
m =

Answer key

  1. 1. lcm(1218, 567) = 32886
  2. 2. lcm(58, 46) = 1334
  3. 3. 21−1 mod 95 = 86
  4. 4. 37−1 mod 62 = 57
  5. 5. 18160 mod 47 = 34
  6. 6. m = 33

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