GATE Computer ScienceHardGATE CS (PYQ pattern)

Consider the congruence 46x ≡ 18 (mod 240). How many solutions x does it have in 0…239, and what is the smallest one?

  1. A. 2 solutions; smallest 63
  2. B. 1 solution: 63
  3. C. 2 solutions; smallest 183
  4. D. 2 solutions; smallest 9

Correct answer: A. 2 solutions; smallest 63

gcd(46, 240) = 2 divides 18, so there are exactly 2 solutions mod 240. Divide by 2: 23x ≡ 9 (mod 120). Extended Euclid gives 23⁻¹ ≡ 47 (mod 120) (23·47 = 1081 = 9·120 + 1), so x ≡ 9·47 = 423 ≡ 63 (mod 120): x = 63 or 183. Reducing 423 mod 240 gives 183, which is a solution but not the smallest.

More Algorithms questions

Exams that ask this topic