Showing:
Handle Score
@Ibrahim Nash 5761
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4944
@saiujwal13083 4506
@sanjay05 3762
@marius_valentin_dragoi 3516
@sushant_a 3459
@verma_ji 3341
@KshamaGupta 3318
Primorial of a number
Easy Accuracy: 12.49% Submissions: 16 Points: 2

Given a number n, the task is to calculate its primorial. Primorial of a number is similar to factorial of a number. In primorial, not all the natural numbers get multiplied; only prime numbers are multiplied to calculate the primorial of a number. It is denoted with P#.

Example 1:

Input:
N = 5
Output: 30
Explanation:
Priomorial = 2 * 3 * 5 = 30
As a side note, factorial is 2 * 3 * 4 * 5

Example 2:

Input:
N = 12
Output: 2310


You don't need to read input or print anything. Your task is to complete the function primorial() which takes the integer N as input parameters and returns the primorial of number n. Since the answer can be quite large print it modulo 109+7.

Expected Time Complexity: O(N*sqrt(N))
Expected Auxiliary Space: O(1)

Constraints:
1 ≤ N ≤ 105