Problem of the day
1. Factors should be strictly greater than 1 and strictly less than ‘N’.
2. If there is no such possible combination of factors, then return an empty list.
Consider the positive integer ‘N’ = 12.
Then, we can observe that -:
12 = 2 * 2 * 3
12 = 2 * 6
12 = 3 * 4
i.e, possible combinations of factors are [2, 2, 3], [2, 6], [3, 4].
Thus, we should return list [[2,2,3], [2,6], [3, 4]]. Note that in this list all combinations are sorted in non-decreasing order, and all the combinations in the list are placed in the lexicographical order.
The first line of input contains an integer ‘T’ denoting the number of test cases. then ‘T’ test cases follow.
The first and the only line of each test case consist of a single integer ‘N’.
For each test case, if there are ‘K’ such possible combinations of factors, then in the first line of the output of the test case print a single integer ‘K’, and then print ‘K’ lines each of them represents a combination of factors of a given integer in non-decreasing order.
The output of each test case will be printed in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 50
2 <= N <= 1000
Where ‘T’ is the total number of test cases, and ‘N’ is the given integer.
Time limit: 1 sec
2
5
12
0
3
2 2 3
2 6
3 4
Test case 1:
The integer 5 is a prime number, and it has no factors. Note, we consider that factors should be strictly greater than 1 and strictly less than ‘N’.
Test case 2:
See the problem statement for an explanation.
2
16
4
4
2 2 2 2
2 2 4
2 8
4 4
1
2 2