Problem 3312 · Hard
Collect the gcd of every index pair, sort the values once, and answer each query by position.
Open the interactive visualisation