Data Structures & AlgorithmsVery hardGATE CS · TCS NQT

How many distinct residues modulo 7 are produced by x * y for x and y ranging over {2, 3, 4} (all ordered pairs, including x = y)?

  1. A. 6
  2. B. 5
  3. C. 4
  4. D. 9

Correct answer: B. 5

Reduce each product modulo 7 first and then count distinct residues. Counting distinct products before reducing gives a different number.

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

Exams that ask this topic