Given a number, find minimum sum of its factors.
Input : 12 Output : 7 Explanation: Following are different ways to factorize 12 and sum of factors in different ways. 12 = 12 * 1 = 12 + 1 = 13 12 = 2 * 6 = 2 + 6 = 8 12 = 3 * 4 = 3 + 4 = 7 12 = 2 * 2 * 3 = 2 + 2 + 3 = 7 Therefore minimum sum is 7 Input : 105 Output : 15
To minimize sum, we must factorize factors as long as possible. With this process, we prime factors. So to find minimum sum of product of number, we find sum of prime factors of product.
This article is contributed by nuclode. 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 write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Find sum of odd factors of a number
- Find sum of even factors of a number
- Queries to find whether a number has exactly four distinct factors or not
- Find minimum number to be divided to make a number a perfect square
- Find minimum number of coins that make a given value
- Find minimum possible digit sum after adding a number d
- Number which has the maximum number of distinct prime factors in the range M to N
- Super Ugly Number (Number whose prime factors are in given set)
- Queries on sum of odd number digit sums of all the factors of a number
- Find minimum number of Log value needed to calculate Log upto N
- Program to find minimum number of lectures to attend to maintain 75%
- Number with maximum number of prime factors
- Find the Largest Cube formed by Deleting minimum Digits from a number
- Find minimum number of merge operations to make an array palindrome
- Sum of all the factors of a number