Give you a sequence of N(N≤100,000)N(N≤100,000) integers : a1,...,an(0<ai≤1000,000,000)a1,...,an(0<ai≤1000,000,000). There are Q(Q≤100,000)Q(Q≤100,000) queries. For each query l,rl,r you have to calculate gcd(al,,al+1,...,ar)gcd(al,,al+1,...,ar) and…