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
012345678mod 9

Find 652 mod 9, the remainder r with 0 ≤ r < 9.

a = 652n = 9
652 mod 9 =
2.Easy
aqbr432=?·200+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(432, 200).

a = 432b = 200
gcd(432, 200) =
3.Medium

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

n = 1331 = 113
φ(1331) =
4.Medium

Solve 46x ≡ 56 (mod 59). Give the solution x with 0 < x < 59.

46x ≡ 56 (mod 59)
x =
5.Hard
mc = me​ mod n120m = cd​ mod n?(n, e) = (391, 17)d

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

p = 17q = 23e = 17c = 120
m =
6.Hard

Use repeated squaring to find 24173 mod 97.

a = 24k = 173n = 97
24173 mod 97 =

Answer key

  1. 1. 652 mod 9 = 4
  2. 2. gcd(432, 200) = 8
  3. 3. φ(1331) = 1210
  4. 4. x = 32
  5. 5. m = 205
  6. 6. 24173 mod 97 = 88

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