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

Find (42·82 + 249) mod 6 without multiplying out the large numbers: reduce first.

n = 6
(42·82 + 249) mod 6 =
2.Easy
0123456mod 7

Find (−65) mod 7, the remainder r with 0 ≤ r < 7.

a = −65n = 7
(−65) mod 7 =
3.Medium

Find the smallest positive integer x with x ≡ 2 (mod 3) and x ≡ 6 (mod 7).

x ≡ 2 (mod 3)x ≡ 6 (mod 7)
x =
4.Medium

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

n = 104 = 23·13
φ(104) =
5.Hard

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

p = 71k = 41606
1841606 mod 71 =
6.Hard
mc = me​ mod n398m = cd​ mod n?(n, e) = (559, 13)d

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

p = 13q = 43e = 13c = 398
m =

Answer key

  1. 1. (42·82 + 249) mod 6 = 3
  2. 2. (−65) mod 7 = 5
  3. 3. x = 20
  4. 4. φ(104) = 48
  5. 5. 1841606 mod 71 = 12
  6. 6. m = 47

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