ProgrammingHardTCS NQT · Infosys

Using square-and-multiply on int values with a reduction modulo 1000 after each multiplication, what is 3^13 mod 1000?

  1. A. 594
  2. B. 1
  3. C. 369
  4. D. 323

Correct answer: D. 323

3^13 = 1594323, and reducing modulo 1000 gives 323. Reducing after each multiplication gives the same residue and keeps values small.

More C Programming questions

Exams that ask this topic