Function to perform the Sieve Of Eratosthenes to find the prime number over the range [ 1 , 10 ^ 5 ]
static void SieveOfEratosthenes ( Vector < pair > v ) { boolean prime [ ] = new boolean [ MAX + 1 ] ; for ( int i = 0 ; i < prime . length ; i ++ ) { prime [ i ] = true ; } prime [ 1 ] = false ; for ( int p = 2 ; p * p <= MAX ; p ++ ) {