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
aqbr516=?·288+??=?·?+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(516, 288).

a = 516b = 288
gcd(516, 288) =
2.Easy
aqbr391=?·357+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(391, 357).

a = 391b = 357
gcd(391, 357) =
3.Medium

Solve 21x ≡ 8 (mod 59). Give the solution x with 0 < x < 59.

21x ≡ 8 (mod 59)
x =
4.Medium

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

n = 169 = 132
φ(169) =
5.Hard

73 is prime. Use Fermat’s little theorem to find 1153698 mod 73.

p = 73k = 53698
1153698 mod 73 =
6.Hard
mc = me​ mod n49m = cd​ mod n?(n, e) = (629, 7)d

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

p = 17q = 37e = 7c = 49
m =

Answer key

  1. 1. gcd(516, 288) = 12
  2. 2. gcd(391, 357) = 17
  3. 3. x = 6
  4. 4. φ(169) = 156
  5. 5. 1153698 mod 73 = 12
  6. 6. m = 127

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