Data Structures & AlgorithmsModerateTCS NQT · SSC CGL Tier 2

Problem: The number 720 is written as a product of primes. What is the sum of its distinct prime factors?

  1. A. 30
  2. B. 19
  3. C. 3
  4. D. 10

Correct answer: D. 10

720 = 2⁴ · 3² · 5, so 2 + 3 + 5 = 10. Adding the prime powers 16 + 9 + 5 gives 30, adding with multiplicity gives 19, and 3 counts the distinct primes.

More Coding Interview Problems questions

Exams that ask this topic