Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

What is the sum of all integers from 1 to 50 inclusive that are coprime to 50?

  1. A. 501
  2. B. 775
  3. C. 625
  4. D. 500

Correct answer: D. 500

Coprime to 50 = 2 * 5^2 means odd and not divisible by 5. The odd numbers total 625 and the odd multiples of 5 (5, 15, 25, 35, 45) total 125, leaving 500.

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

Exams that ask this topic