prime factorization of P
for ( let i = 2 ; i * i <= P ; i ++ ) { while ( P % i == 0 ) { if ( prime_factors . get ( i ) == null ) prime_factors . set ( i , 1 ) ; else prime_factors . set ( i , ( prime_factors . get ( i ) + 1 ) ) ; P = Math . floor ( P / i ) ; } } if ( P != 1 ) prime_factors [ P ] ++ ;