Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

What is the smallest positive integer that is divisible by every integer from 1 to 12 and is also a perfect square?

  1. A. 21344399
  2. B. 21344400
  3. C. 21344402
  4. D. 42688800

Correct answer: B. 21344400

The lcm of 1 to 12 is 27720 = 2^3 * 3^2 * 5 * 7 * 11. A perfect square needs every prime to an even power, so x must be divisible by 2^2 * 3 * 5 * 7 * 11 = 4620, and the answer is 4620^2.

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

Exams that ask this topic