Counting affine cipher keys for two alphabets

An affine cipher encrypts with E(x)=(ax+b) mod nE(x) = (ax + b) \bmod n, where aa and bb are whole numbers from 0 to n−1n - 1. A key (a,b)(a, b) is usable only if every message can be decrypted, which requires gcd⁡(a,n)=1\gcd(a, n) = 1; any bb is allowed.


One version uses the 26-letter alphabet, so n=26n = 26. An extended version adds space, full stop and comma, giving 29 symbols, so n=29n = 29. Give each answer as a whole number:

  • the number of valid multipliers aa for n=26n = 26
  • the total number of usable keys (a,b)(a, b) for n=26n = 26
  • the number of valid multipliers aa for n=29n = 29
  • the total number of usable keys (a,b)(a, b) for n=29n = 29
Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Basics of Cryptography Questions: