ProgrammingVery hardGATE CS · Campus placements

Using fast exponentiation with reduction modulo 1000000007 after each multiplication, what is 2^100 mod 1000000007?

  1. A. 976371285
  2. B. 1024
  3. C. 1000000006
  4. D. 0

Correct answer: A. 976371285

Square-and-multiply reduces each step, and the result is 976371285. Computing 2^100 exactly and reducing once gives the same residue, while 1024 is only 2^10.

More C Programming questions

Exams that ask this topic