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
aqbr689=?·39+??=?·?+??=?·?+?

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

a = 689b = 39
lcm(689, 39) =
2.Easy
aqbr774=?·234+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(774, 234).

a = 774b = 234
gcd(774, 234) =
3.Medium

Solve 20x ≡ 37 (mod 49). Give the solution x with 0 < x < 49.

20x ≡ 37 (mod 49)
x =
4.Medium

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

n = 14 = 2·7
φ(14) =
5.Hard
mc = me​ mod n167m = cd​ mod n?(n, e) = (203, 11)d

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

p = 7q = 29e = 11c = 167
m =
6.Hard

97 is prime. Use Fermat’s little theorem to find 1439770 mod 97.

p = 97k = 39770
1439770 mod 97 =

Answer key

  1. 1. lcm(689, 39) = 2067
  2. 2. gcd(774, 234) = 18
  3. 3. x = 19
  4. 4. φ(14) = 6
  5. 5. m = 125
  6. 6. 1439770 mod 97 = 44

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