Function to generate the prime numbers using Sieve of Eratosthenes
static void buildSieve ( int sum ) { prime = new bool [ sum + 1 ] ; for ( int i = 0 ; i < prime . Length ; i ++ ) prime [ i ] = true ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p < ( sum + 1 ) ; p ++ ) {