Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

How many integers x in [1, 1000] have exactly 4 positive divisors?

  1. A. 292
  2. B. 293
  3. C. 294
  4. D. 296

Correct answer: A. 292

Numbers with exactly four divisors are of the form p^3 or p*q for distinct primes p and q. Counting these forms gives the total without listing divisors for each x.

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

Exams that ask this topic