Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div2 B

How many pairs i < j with 1 <= i, j <= 12 have i times j divisible by 12?

  1. A. 21
  2. B. 16
  3. C. 24
  4. D. 19

Correct answer: D. 19

Look at each prime power of 12 (2^2 and 3) and check how each index contributes to the factorisation of i times j. Counting pairs with i = j wrongly would add extra cases.

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

Exams that ask this topic