If i is prime , then update its powers in all multiples of it .
if ( isPrime [ i ] ) { for ( int j = i ; j < MAX ; j += i ) { int k , l ; isPrime [ j ] = false ; for ( k = j , l = 0 ; k % i == 0 ; l ++ , k /= i ) ; factors [ j ] . push_back ( make_pair ( i , l ) ) ; } } } }