Data Structures & AlgorithmsHardGATE CS · ICPC regional

How many integers x in [1, 100] satisfy that x^2 + x + 41 is divisible by 43?

  1. A. 6
  2. B. 5
  3. C. 7
  4. D. 9

Correct answer: B. 5

Solve x^2 + x + 41 = 0 modulo 43 by testing residues 0 to 42, then extend each solution by multiples of 43 up to 100. Counting only the residues without extension undercounts.

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

Exams that ask this topic