Find all the prime factors and their powers
while ( N > 1 ) : NEW_LINE INDENT N //= s [ N ] NEW_LINE if N and s [ N ] : NEW_LINE INDENT if cnt . get ( s [ N ] , 0 ) == 0 : NEW_LINE INDENT cnt [ s [ N ] ] = 1 NEW_LINE DEDENT else : NEW_LINE INDENT cnt [ s [ N ] ] += 1 NEW_LINE DEDENT DEDENT DEDENT if 0 in cnt : NEW_LINE INDENT cnt . pop ( 0 ) NEW_LINE DEDENT totfactor = 1 NEW_LINE for i in cnt . values ( ) : NEW_LINE INDENT totfactor *= i + 1 NEW_LINE DEDENT