GATE Computer ScienceModerateGATE CS (PYQ pattern)
How many integers in 1…1000 are coprime to 360?
- A. 267
- B. 96
- C. 266
- D. 233
Correct answer: C. 266
360 = 2³·3²·5, so we exclude multiples of 2, 3 or 5: 1000 − (500 + 333 + 200) + (166 + 100 + 66) − 33 = 266. Scaling φ(360)/360 = 4/15 to 1000 gives 266.67, rounded wrongly to 267; 96 = φ(360) counts only up to 360.
More Algorithms questions
- 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?
- Let T(n) = T(n − ⌊√n⌋) + 1 for n > 1 and T(1) = 0. Which is the tight bound?