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
aqbr1008=?·414+??=?·?+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(1008, 414).

a = 1008b = 414
gcd(1008, 414) =
2.Easy
aqbr840=?·792+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(840, 792).

a = 840b = 792
gcd(840, 792) =
3.Medium

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

n = 24 = 23·3
φ(24) =
4.Medium

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

a = 9n = 41
9−1 mod 41 =
5.Hard
mc = me​ mod n815m = cd​ mod n?(n, e) = (1333, 13)d

An RSA key uses p = 31, q = 43 and e = 13. Decrypt the ciphertext c = 815: find the message m.

p = 31q = 43e = 13c = 815
m =
6.Hard
mc = me​ mod n49m = cd​ mod n?(n, e) = (451, 7)d

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

p = 11q = 41e = 7c = 49
m =

Answer key

  1. 1. gcd(1008, 414) = 18
  2. 2. gcd(840, 792) = 24
  3. 3. φ(24) = 8
  4. 4. 9−1 mod 41 = 32
  5. 5. m = 537
  6. 6. m = 389

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