Medium Accuracy: 62.87%
Submissions: 3258 Points: 4
Given two numbers L and R (inclusive) find the product of primes within this range. Print the product modulo 109+7. If there are no primes in that range you must print 1.
Input: L = 1, R = 10
Explaination: The prime numbers are
2, 3, 5 and 7.
Input: L = 1, R = 20
Explaination: The primes are 2, 3,
5, 7, 11, 13, 17 and 19.
You do not need to read input or print anything. Your task is to complete the function primeProduct() which takes L and R and returns the product of the primes within the range. If there are no primes in that range then return 1.
Expected Time Complexity: O((R-L)*(logR)) Expected Auxiliary Space: O(sqrt(R))