Find minimum sum of factors of number | To find minimum sum of product of number ; Find factors of number and add to the sum ; Return sum of numbers having minimum product ; Driver Code
function findMinSum ( num ) { let sum = 0 ; for ( let i = 2 ; i * i <= num ; i ++ ) { while ( num % i == 0 ) { sum += i ; num /= i ; } } sum += num ; return sum ; } let num = 12 ; document . write ( findMinSum ( num ) ) ;