Divisor Queries.

2.3

3 votes
Data Structures, Recruit, Number Theory, Hiring, Easy-Medium, Mathematics, Approved
Problem

Consider the Function:

F(X) = Number of Divisors of Integer X

You have been given an array consisting of N integers and M queries .There can be only 1 type of query i.e :

query(l,r) : You need to find product of all number in the range from l to r inclusive and then output the result of function F(X) mod 109+7 for that product.

Input Format:

The first line contains 2 integers N and M denoting the number of array elements and the number of queries The next line contains N numbers denoting the elements of the array .

Each of the next M lines contains 2 integers l and r for whom the query needs to be answered.

Output Format:

For each query you need to print a single number denoting the answer to that query mod 109+7

Constraints:

1N5105

1M4105

1lrN

1a[i]10

Note: Each element of the array shall not have a value greater than 10.

Sample Input
6 2
1 2 3 4 5 6
1 2 
1 6
Sample Output
2
30
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

For the 1st query, the product is 2 , F(2)=2. For the second query , product=720 , F(720)=30.

Editor Image

?