There is a fight between Spiderman and the Zombie. Spiderman has to protect the planet earth, and for this, he has to give punches in the head of the zombie. The Spiderman is given an integer ‘N’ and he has to construct a number ‘Num’ such that the count of nice divisors of ‘NUM’ is maximum and the constructed number has at most 'N' prime factors. It is not necessary for all prime factors of ‘NUM’ to be distinct. A divisor of ‘NUM’ is called nice if it is divisible by every prime factor of ‘NUM’. Assuming yourselves as spiderman protect the planet earth by returning the nice divisors of ‘NUM’.
Return the number of nice divisors of ‘NUM’. Since that number can be too large, return it modulo 10^9 + 7.
For Example:
If N = 12, then its prime factors are [2, 2, 3], then 6 and 12 are nice divisors, while 3, 4, and 2 are not.
The first line of input contains an integer ‘T’, denoting the number of test cases.
The first line of each test case contains an integer ‘N’, denoting the count of prime factors that Spiderman has.
Output format:
For each test case, return the count of nice divisors of 'NUM' that will be constructed.
Note:
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 1000
1 <= N <= 10^9
Time Limit: 1 sec
2
5
4
6
4
For the first test case, If we take ‘Num’ equal to 72, then its prime factors are [2, 2, 2, 3, 3], and the divisors of 72 are [1, 2, 3, 4, 6, 8, 9, 12, 18, 24, 36, 72]. Among all the divisors, the nice divisors are [6, 12, 18, 24, 36, 72]. So the output is 6.
For the second test case, If we take ‘Num’ equal to 36, then its prime factors are [2, 2, 3, 3], and the divisors of 36 are [1, 2, 3, 4, 6, 9, 12, 18, 36]. Among all the divisors, the nice divisors are [6, 12, 18, 36]. So the output is 4.
2
8
7
18
12
Try to break the N as a sum of 3’s.
Approach:
Algorithm:
O(N), where ‘N’ is the total number of prime factors.
Since for each N, we are breaking it into groups of 3 and then calculating the Res for each part of N, which takes O(N) time. So overall, time complexity will be O(N).
O(1).
Since constant space is being used. So overall space complexity is O(1).