Function for Sieve of Eratosthenes
static void sieve ( ) { for ( int i = 2 ; i < sz + 1 ; i ++ ) isPrime [ i ] = true ; for ( int i = 2 ; i * i <= sz ; i ++ ) { if ( isPrime [ i ] ) { for ( int j = i * i ; j < sz ; j += i ) { isPrime [ j ] = false ; } } } }