Write a program to print all the combinations of factors of given number n.
Input : 16 Output :2 2 2 2 2 2 4 2 8 4 4 Input : 12 Output : 2 2 3 2 6 3 4
To solve this problem we take one array of array of integers or list of list of integers to store all the factors combination possible for the given n. So, to achieve this we can have one recursive function which can store the factors combination in each of its iteration. And each of those list should be stored in the final result list.
Below is the implementation of the above approach.
2 2 2 2 2 2 4 2 8 4 4
- Print all numbers whose set of prime factors is a subset of the set of the prime factors of X
- Ways to express a number as product of two different factors
- Print all combinations of balanced parentheses
- Print all possible combinations of r elements in a given array of size n
- Print all the combinations of a string in lexicographical order
- Print all combinations of points that can compose a given number
- Print combinations of distinct numbers which add up to give sum N
- Print all prime factors and their powers
- Program to print factors of a number in pairs
- C Program for efficiently print all prime factors of a given number
- Efficient program to print all prime factors of a given number
- Efficient program to print the number of factors of n numbers
- Java Program for efficiently print all prime factors of a given number
- Find number of factors of N when location of its two factors whose product is N is given
- All unique combinations whose sum equals to K
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.