It is possible to store index for each prime that is in factorization of array elements, and for query number look at indices of it's factorization in range that is given and find maximal GCD between them.
Indices can be implemented as lists with pairs (position in array, prime power), with that searching for segment is in log.
E.g. if array is [4, 5, 8, 12, 3] than we have 3 different primes (2, 3, 5) and indices:
2 -> [(0, 4), (2, 8), (3, 4)]
3 -> [(3, 3), (4, 3)]
5 -> [(1,5)]
For query (6, 1, 3), since 6=2*3 has to look in sub-indices:
2 -> [(2, 8), (3, 4)]
3 -> [(3, 3)]
Going 'parallel' through these sub-indices, and making product of GCD's for primes (minimum of prime power in query number and index second element) will produce all possible GCD's.