P5655 Basic Number Theory Function Practice Problem.
Background
YSGH is awesome.
Description
Given an array $a$ of length $n$, answer $Q$ 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 ${10}^9 + 7$.
Input Format
This problem contains multiple test cases.
The first line contains a positive integer $T$, indicating the number of test cases.
For each test case, the first line contains two positive integers $n, Q$.
In the next $n$ lines, the $i$-th line contains a positive integer $a_i$.
In the next $Q$ lines, each line contains two positive integers $l, r$ ($1 \le l \le r \le n$), representing one query.
Output Format
For each query, output one integer per line, representing the answer.
Explanation/Hint
| Test Point ID | $n, Q, T \le$ | $a_i \le$ |
| :--: | :--: | :--: |
| $1$ | $10$ | $10$ |
| $2$ | $20$ | $2^{60}$ |
| $3$ | $50$ | $2^{60}$ |
| $4$ | $100$ | $2^{60}$ |
| $5$ | $150$ | $2^{60}$ |
| $6$ | $200$ | $2^{60}$ |
| $7$ | $240$ | $2^{60}$ |
| $8$ | $260$ | $2^{60}$ |
| $9$ | $280$ | $2^{60}$ |
| $10$ | $300$ | $2^{60}$ |
For $100\%$ of the testdata, $1 \le n, Q, T \le 300$, $1 \le a_i \le 2^{60}$.
Translated by ChatGPT 5