You are given a positive integer N and an equation 1/X + 1/Y = 1/N
You need to determine the count of all possible positive integral solutions (X, Y) for the above equation.
Note:
1. X and Y should be greater than 0.
2. (X, Y) and (Y, X) are considered different solutions if X is not equal to Y, i.e. (X, Y) and (Y, X) will not be distinct if X=Y.
The first line of the input contains an integer 'T' denoting the number of test cases.
The first and only line of each test case consists of a single positive integer 'N'.
Output Format:
For each test case, print an integer that denotes the count of the number of pairs satisfying the equation in a new line.
The output of each test case should be printed in a separate line.
Note:
You don't have to print anything. It has already been taken care of. Just Implement the given function.
1 <= T <= 100
1 <= N <= 10^4
Where 'T' is the number of test cases, and 'N' is the given integer.
Time Limit: 1 sec.
1
5
3
There are only 3 pairs satisfying the given equation { (6, 30), (10, 10), (30, 6) }.
Eg. 1/6 + 1/30 = 1/5, 1/10 + 1/10 = 1/5.
1
6
9
There are 6 pairs satisfying the given equation { (7, 42), (8, 24), (9, 18), (10, 15), (12, 12), (15, 10), (18, 9), (24, 8), (42, 7) }.
Eg. 1/7 + 1/42 = 1/6, 1/9 + 1/18 = 1/6.
Iterate over all possible values of (X, Y).
O(N^4), where N is the given positive integer.
As X and Y may take values in the range N + 1 to N^2 + N, hence there are N^2 different values for X and Y. So the total number of pairs (X, Y) is of the order of N^4.
O(1).
We are using constant extra memory.