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
aqbr423=?·396+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(423, 396).

a = 423b = 396
gcd(423, 396) =
2.Easy
aqbr259=?·175+??=?·?+??=?·?+?

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

a = 259b = 175
lcm(259, 175) =
3.Medium

Solve 22x ≡ 18 (mod 29). Give the solution x with 0 < x < 29.

22x ≡ 18 (mod 29)
x =
4.Medium

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

a = 21n = 94
21−1 mod 94 =
5.Hard
mc = me​ mod ncm = cd​ mod nm(n, e) = (713, 7)d = ?

An RSA key uses the primes p = 23 and q = 31 and the public exponent e = 7. Find the private exponent d (0 < d < φ(n)).

p = 23q = 31e = 7
d =
6.Hard

Use repeated squaring to find 861 mod 25.

a = 8k = 61n = 25
861 mod 25 =

Answer key

  1. 1. gcd(423, 396) = 9
  2. 2. lcm(259, 175) = 6475
  3. 3. x = 14
  4. 4. 21−1 mod 94 = 9
  5. 5. d = 283
  6. 6. 861 mod 25 = 8

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