To check if a number is prime
bool [ ] isPrime = new bool [ MAX ] ; for ( int i = 0 ; i < MAX ; i ++ ) isPrime [ i ] = true ; isPrime [ 0 ] = isPrime [ 1 ] = false ; for ( int i = 2 ; i < MAX ; i ++ ) {