Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

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

  1. A. 11
  2. B. 12
  3. C. 13
  4. D. 15

Correct answer: A. 11

Exactly three divisors means x = p^2 for a prime p. The primes p with p^2 <= 1000 are 2, 3, ..., 31, which are 11 primes.

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

Exams that ask this topic