Find all the prime factors and their powers
while ( N > 1 ) { N /= s [ N ] ; if ( N and s [ N ] ) if ( cnt . find ( s [ N ] ) == cnt . end ( ) ) cnt [ s [ N ] ] = 1 ; else cnt [ s [ N ] ] += 1 ; } if ( cnt . find ( 0 ) != cnt . end ( ) ) cnt . erase ( 0 ) ; int totfactor = 1 ; for ( auto i : cnt ) totfactor *= i . second + 1 ;