Data Structures & AlgorithmsModerateICPC regional · algorithm theory

Problem: For coprime m and n, which identity for Euler's totient function is correct?

  1. A. phi(mn) = phi(m) * phi(n)
  2. B. phi(m + n) = phi(m) + phi(n)
  3. C. phi(mn) = mn
  4. D. phi(m * n) = phi(m) * phi(n) - 1

Correct answer: A. phi(mn) = phi(m) * phi(n)

The totient is multiplicative over coprime arguments, which is why sieving by prime factors works.

More Coding Interview Problems questions

Exams that ask this topic