How to handle large number of queries related to finding LCM of all numbers in the range [L,R]??

Revision en1, by thebruisedsoul, 2015-10-08 23:20:43

I am trying to solve this problem, which provides an array of N integers , and requires to compute for M number of queries LCM of all the elements of the array in the range of indices [L,R] . As the answer can be very large print it modulo 10^9+7. 1<=M<=100000 1<=L<=R<=N. Please help to solve this problem.

Tags lcm, number theory

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English thebruisedsoul 2015-10-08 23:20:43 486 Initial revision (published)