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
aqbr140=?·48+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(140, 48).

a = 140b = 48
gcd(140, 48) =
2.Easy
aqbr315=?·99+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(315, 99).

a = 315b = 99
gcd(315, 99) =
3.Medium

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

n = 18 = 2·32
φ(18) =
4.Medium

Solve 19x ≡ 1 (mod 43). Give the solution x with 0 < x < 43.

19x ≡ 1 (mod 43)
x =
5.Hard
29c = me​ mod n?m = cd​ mod nm(n, e) = (391, 13)d

Encrypt the message m = 29 with the RSA public key (n, e) = (391, 13). Find the ciphertext c.

n = 391e = 13m = 29
c =
6.Hard

61 is prime. Use Fermat’s little theorem to find 1646314 mod 61.

p = 61k = 46314
1646314 mod 61 =

Answer key

  1. 1. gcd(140, 48) = 4
  2. 2. gcd(315, 99) = 9
  3. 3. φ(18) = 6
  4. 4. x = 34
  5. 5. c = 82
  6. 6. 1646314 mod 61 = 58

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