Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

What is gcd(2^12 - 1, 2^8 - 1)?

  1. A. 15
  2. B. 16
  3. C. 17
  4. D. 19

Correct answer: A. 15

gcd(2^a - 1, 2^b - 1) = 2^gcd(a,b) - 1; here gcd(12, 8) = 4, so the answer is 2^4 - 1 = 15.

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

Exams that ask this topic