Data Structures & AlgorithmsModerateGATE CS · ICPC regional

How many ordered pairs (i, j) with 1 <= i, j <= 18 have i * j divisible by 18?

  1. A. 66
  2. B. 59
  3. C. 63
  4. D. 69

Correct answer: C. 63

Factor 18 = 2 * 3^2 and count how each index contributes these prime powers; the answer is not simply a product of multiples of 2 and 3.

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

Exams that ask this topic