Magic Number Group
题号:NC229246
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

SevenFireflie has a sequence of positive integers with a length of n and quickly calculates all the factors of each number. In order to exercise his factor calculation ability, he has selected q consecutive subsequences from the sequence and found a positive integer p greater than 1 for each subsequence, so that p can divide as many numbers in this subsequence as possible. He has also found that p may have more than one.

So the question is, how many numbers in each subsequence can be divided at most?

输入描述:

The first line contains an integer T (), indicating that there is T test cases next. 
The first line of each test cases has two positive integers n (),q ().
Next line n integers a_i (), which representing the numbers in this sequence. The two adjacent numbers are separated by a space.
Each of the next q lines contains integers l,r (), representing a subsequence being queried, , and l ,r are separated by a space.
The input guarantees that the sum of n does not exceed and the sum of q does not exceed .

输出描述:

For each test case, output q lines, each line a positive integer, indicating the answer.
示例1

输入

复制
1
10 5
20 15 6 1 21 12 2 3 17 9
1 4
2 5
3 6
4 7
5 10

输出

复制
2
3
3
2
4