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 email@example.com. 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.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Find number of factors of N when location of its two factors whose product is N is given
- Maximum number of prime factors a number can have with exactly x factors
- Check if a number exists having exactly N factors and K prime factors
- Print all numbers whose set of prime factors is a subset of the set of the prime factors of X
- Find sum of odd factors of a number
- Find sum of even factors of a number
- Queries on sum of odd number digit sums of all the factors of a number
- Number of factors of very large number N modulo M where M is any prime number
- Sum of M maximum distinct digit sum from 1 to N that are factors of K
- Find four factors of N with maximum product and sum equal to N | Set-2
- Find four factors of N with maximum product and sum equal to N
- Find four factors of N with maximum product and sum equal to N | Set 3
- Find sum of exponents of prime factors of numbers 1 to N
- Find prime factors of Array elements whose sum of exponents is divisible by K
- Sum of all the factors of a number
- Expressing a number as sum of consecutive | Set 2 (Using odd factors)
- Sum of Factors of a Number using Prime Factorization
- Queries to find whether a number has exactly four distinct factors or not
- Program to find all Factors of a Number using recursion
- Find all Factors of Large Perfect Square Natural Number in O(sqrt(sqrt(N))