Product of Primes
Submissions: 2335   Accuracy:


  Difficulty: Medium   Marks: 4

Given two numbers L and R (inclusive) find the product of primes within this range. Print the product modulo 10^9+7. If there are no primes in that range you must print 1.

The first line of the input contains T the number of test cases.  Then T lines follow. Each test case contains one line , having two values L and which denotes the range of the numbers.

For each test case print the product modulo 10^9+7 in a new line.


Constraints :             




 1 10
 1 20

 Output : 

Explanation :

For the first test case, primes are 2,3,5,7. and their product is 2*3*5*7=210.

For the second test case primes are 2,3,5,7,11,13,17,19. and their product is  9699690.

** For More Input/Output Examples Use 'Expected Output' option **

Author: Arnab Deb

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use, generate link and share the link here.

to report an issue on this page.