Data Structures & AlgorithmsHardGATE CS · ICPC regional

How many integers in [1, 100] have exactly two distinct prime factors (counted without multiplicity)?

  1. A. 56
  2. B. 57
  3. C. 58
  4. D. 60

Correct answer: A. 56

Numbers such as 6, 10, 12 and 18 qualify; 12 = 2^2 * 3 has two distinct primes even though its prime factors repeat. Counting only square-free numbers would miss such cases.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic