Product of factors of number | Python program to calculate product of factors of number ; function to product the factors ; If factors are equal , multiply only once ; Otherwise multiply both ; Driver Code
M = 1000000007 NEW_LINE def multiplyFactors ( n ) : NEW_LINE INDENT prod = 1 NEW_LINE i = 1 NEW_LINE while i * i <= n : NEW_LINE INDENT if ( n % i == 0 ) : NEW_LINE INDENT if ( n / i == i ) : NEW_LINE INDENT prod = ( prod * i ) % M NEW_LINE DEDENT else : NEW_LINE INDENT prod = ( prod * i ) % M NEW_LINE prod = ( prod * n / i ) % M NEW_LINE DEDENT DEDENT i = i + 1 NEW_LINE DEDENT return prod NEW_LINE DEDENT n = 12 NEW_LINE print ( multiplyFactors ( n ) ) NEW_LINE