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
aqbr116=?·50+??=?·?+??=?·?+?

Use Euclid’s algorithm to find gcd(116, 50).

a = 116b = 50
gcd(116, 50) =
2.Easy
aqbr1176=?·819+??=?·?+??=?·?+??=?·?+??=?·?+?

Find the least common multiple lcm(1176, 819). Use Euclid’s algorithm for the gcd first.

a = 1176b = 819
lcm(1176, 819) =
3.Medium

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

n = 1183 = 7·132
φ(1183) =
4.Medium

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

a = 7n = 45
7−1 mod 45 =
5.Hard
mc = me​ mod n27m = cd​ mod n?(n, e) = (95, 23)d

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

p = 5q = 19e = 23c = 27
m =
6.Hard

Use repeated squaring to find 1622 mod 27.

a = 16k = 22n = 27
1622 mod 27 =

Answer key

  1. 1. gcd(116, 50) = 2
  2. 2. lcm(1176, 819) = 45864
  3. 3. φ(1183) = 936
  4. 4. 7−1 mod 45 = 13
  5. 5. m = 88
  6. 6. 1622 mod 27 = 7

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