traverse all prime factors and multiply its 1 / N power to the result
Set < Map . Entry < Integer , Integer > > st = prime_factors . entrySet ( ) ; for ( Map . Entry < Integer , Integer > me : st ) { ans *= Math . pow ( me . getKey ( ) , me . getValue ( ) / N ) ; } return ans ; }