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
aqbr531=?·459+??=?·?+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(531, 459).

a = 531b = 459
gcd(531, 459) =
2.Easy
aqbr92=?·66+??=?·?+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(92, 66).

a = 92b = 66
gcd(92, 66) =
3.Medium

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

n = 343 = 73
φ(343) =
4.Medium

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

n = 500 = 22·53
φ(500) =
5.Hard
mc = me​ mod n80m = cd​ mod n?(n, e) = (799, 7)d

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

p = 17q = 47e = 7c = 80
m =
6.Hard

71 is prime. Use Fermat’s little theorem to find 2928007 mod 71.

p = 71k = 28007
2928007 mod 71 =

Answer key

  1. 1. gcd(531, 459) = 9
  2. 2. gcd(92, 66) = 2
  3. 3. φ(343) = 294
  4. 4. φ(500) = 200
  5. 5. m = 602
  6. 6. 2928007 mod 71 = 25

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