#P5655. 基础数论函数练习题

基础数论函数练习题

Description

Given an array aa of length nn, answer QQ queries of $\operatorname{lcm}(a_l, a_{l + 1}, \ldots , a_{r - 1}, a_r)$.

Since the output can be large, you only need to output the answer modulo 109+7{10}^9 + 7.

Input Format

This problem contains multiple test cases.

The first line contains a positive integer TT, indicating the number of test cases.

For each test case, the first line contains two positive integers n,Qn, Q.

In the next nn lines, the ii-th line contains a positive integer aia_i.

In the next QQ lines, each line contains two positive integers l,rl, r (1lrn1 \le l \le r \le n), representing one query.

Output Format

For each query, output one integer per line, representing the answer.

1
3 3
63
70
112
1 2
1 3
2 3
630
5040
560

Hint

Test Point ID n,Q,Tn, Q, T \le aia_i \le
11 1010
22 2020 2602^{60}
33 5050
44 100100
55 150150
66 200200
77 240240
88 260260
99 280280
1010 300300

For 100%100\% of the testdata, 1n,Q,T3001 \le n, Q, T \le 300, 1ai2601 \le a_i \le 2^{60}.

Translated by ChatGPT 5