Data Structures & AlgorithmsHardGATE CS · ICPC regional

What is 2^100 mod 7?

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

Correct answer: A. 2

Since 2^3 = 8 is 1 modulo 7, the powers repeat every 3 steps, and 100 = 3*33 + 1 leaves a remainder of 1, so 2^100 is 2 modulo 7.

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

Exams that ask this topic