Data Structures & AlgorithmsHardGATE CS · ICPC regional

How many integers n with 2 <= n <= 200 are square-free (not divisible by the square of any integer greater than 1)?

  1. A. 123
  2. B. {C-4}
  3. C. 127
  4. D. 121

Correct answer: D. 121

A square-free number is one none of whose prime factors appear squared; test divisibility by d^2 for d from 2 to sqrt(n). Counting the non-square numbers instead gives a different answer.

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

Exams that ask this topic