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?
- A. 2 solutions; smallest 63
- B. 1 solution: 63
- C. 2 solutions; smallest 183
- 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
- How many integers in 1…1000 are coprime to 360?
- A dynamic array has capacity 1 initially. An append to a full array doubles the capacity (copying all n current elements); after a…
- A 4-input comparator network applies, in order, the comparators (0,1), (2,3), (0,2), (1,3), (1,2), each putting the smaller value on the…
- How many comparators does Batcher's bitonic sorting network for 16 inputs use?
- Which is the tight solution of T(n) = 3T(n/4) + n^(log₄3)·log₂ n?
- Solve T(n) = 2T(√n) + log₂ n for large n. Which is the tight bound?