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
aqbr148=?·124+??=?·?+??=?·?+?

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

a = 148b = 124
lcm(148, 124) =
2.Easy
aqbr522=?·99+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(522, 99).

a = 522b = 99
gcd(522, 99) =
3.Medium

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

a = 39n = 58
39−1 mod 58 =
4.Medium

Find Euler’s totient φ(539), the number of integers from 1 to 539 that are coprime to 539.

n = 539 = 72·11
φ(539) =
5.Hard

Use repeated squaring to find 19109 mod 27.

a = 19k = 109n = 27
19109 mod 27 =
6.Hard
mc = me​ mod n16m = cd​ mod n?(n, e) = (77, 23)d

An RSA key uses p = 7, q = 11 and e = 23. Decrypt the ciphertext c = 16: find the message m.

p = 7q = 11e = 23c = 16
m =

Answer key

  1. 1. lcm(148, 124) = 4588
  2. 2. gcd(522, 99) = 9
  3. 3. 39−1 mod 58 = 3
  4. 4. φ(539) = 420
  5. 5. 19109 mod 27 = 19
  6. 6. m = 25

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