prime factorization of P
for ( int i = 2 ; i * i <= P ; i ++ ) { while ( P % i == 0 ) { if ( ! prime_factors . ContainsKey ( i ) ) prime_factors . Add ( i , 1 ) ; else prime_factors [ i ] = prime_factors [ i ] + 1 ; P /= i ; } } if ( P != 1 ) if ( ! prime_factors . ContainsKey ( P ) ) prime_factors . Add ( P , 1 ) ; else prime_factors [ P ] = prime_factors [ P ] + 1 ;