If i is a factors then increase the frequency of i
while ( N % i == 0 ) { if ( Map . ContainsKey ( i ) ) Map [ i ] = Map [ i ] + 1 ; else Map . Add ( i , 1 ) ; N /= i ; } } if ( N > 2 ) { if ( Map . ContainsKey ( N ) ) Map [ N ] = Map [ N ] + 1 ; else Map . Add ( N , 1 ) ; } }