Python Program for Find minimum sum of factors of number Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report Given a number, find minimum sum of its factors.Examples: Input : 12Output : 7Explanation: Following are different ways to factorize 12 andsum of factors in different ways.12 = 12 * 1 = 12 + 1 = 1312 = 2 * 6 = 2 + 6 = 812 = 3 * 4 = 3 + 4 = 712 = 2 * 2 * 3 = 2 + 2 + 3 = 7Therefore minimum sum is 7Input : 105Output : 15 Python3 # Python program to find minimum # sum of product of number # To find minimum sum of # product of number def find_min_sum(num): min_sum = num for i in range(2, int(num**0.5) + 1): if num % i == 0: factor = num // i min_sum = min(min_sum, i + factor) return min_sum # driver code number = 16 # Call the function and print the result result = find_min_sum(number) print("The minimum sum of factors for", number, "is", result) # This code is contributed by AYUSH MILAN Output: 8Time Complexity: O(n1/2 * log n) Auxiliary Space: O(1)Please refer complete article on Find minimum sum of factors of number for more details! Comment More infoAdvertise with us Next Article Python | sympy.factorint() method K kartik Follow Improve Article Tags : Python Practice Tags : python Similar Reads Python Program for Number of elements with odd factors in given range Given a range [n,m], find the number of elements that have odd number of factors in the given range (n and m inclusive). Examples: Input : n = 5, m = 100 Output : 8 The numbers with odd factors are 9, 16, 25, 36, 49, 64, 81 and 100 Input : n = 8, m = 65 Output : 6 Input : n = 10, m = 23500 Output : 2 min read Python Program for Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! +.......+ n/n! You have been given a series 1/1! + 2/2! + 3/3! + 4/4! +.......+ n/n!, find out the sum of the series till nth term. Examples: Input :n = 5 Output : 2.70833 Input :n = 7 Output : 2.71806 Python3 # Python code to find smallest K-digit # number divisible by X def sumOfSeries(num): # Computing MAX res 1 min read Python | sympy.factorint() method With the help of sympy.factorint() method, we can find the factors and their corresponding multiplicities of a given integer. For input less than 2, factorint() behaves as follows: factorint(1) - returns the empty factorization {}. factorint(0) - returns {0:1}. factorint(-n) - adds -1:1 to the facto 1 min read Python | sympy.primefactors() method With the help of sympy.primefactors() method, we can find the prime factors of a given number. Unlike factorint(), primefactors() does not return -1 or 0. Syntax: primefactors(n) Parameter: n - It denotes an integer. Returns: Returns a list of prime factors of the given integer. Example #1: Python3 1 min read PrimePy module in Python A prime number is a natural number greater than 1 whose only factors are 1 and the number itself. 2 is the only even Prime number. We can represent any prime number with '6n+1' or '6n-1' (except 2 and 3) where n is a natural number. primePy is that library of Python which is used to compute operatio 3 min read Python | sympy.divisor_sigma() method With the help of sympy.divisor_sigma() method, we can find the divisor function \sigma_k(n) for positive integer n. divisor_sigma(n, k) is equal to the sum of all the divisors of n raised to the power of k or sum([x**k for x in divisors(n)]). Syntax: divisor_sigma(n, k) Parameter: n - It denotes an 1 min read Like