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
- Ways to express a number as product of two different factors
- Print all combinations of balanced parentheses
- Print all numbers whose set of prime factors is a subset of the set of the prime factors of X
- Print all the combinations of a string in lexicographical order
- Print all combinations of points that can compose a given number
- Print all possible combinations of r elements in a given array of size 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 the number of factors of n numbers
- Efficient program to print all prime factors of a given number
- Java Program for efficiently print all prime factors of a given number
- Combinations in a String of Digits
- Find all combinations that add upto given number
- No of Factors of n!
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.