Divisor queries

1

1 votes
Hiring, Open, Recruit, Approved, Hiring, Open, Recruit, Approved, Medium, Hiring, Ternary Search, Number Theory, Data Structures, Algorithms, Mathematics, Searching
Problem

Consider the following function:

F(X) = Number of divisors of integer X

You are given an array that consists of N integers. You are also provided M queries. There can be only one type of query, query(l,r). You are required to determine the product of all the numbers in the range from l to r. The output can contain the values of l and r. Your task is to print the result of function F(X) mod 109+7 for that product.

Input format

  • First line: Two integers N and M denoting the number of array elements and the number of queries
  • Next line: N numbers denoting the elements of the array
  • Next M lines: Two integers l and r for which the query must be answered

Output format

For each query, you are required to print a single number denoting the answer to that query mod 109+7.

Constraints

1N5×105

1M4×105

1lrN

1a[i]10

Note: Each element of the array cannot contain a value that is greater than 10.

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

?