In general Sieve of Sundaram , produces primes smaller than ( 2 * x + 2 ) for a number given number x . Since we want primes smaller than MAX , we reduce MAX to half
bool marked [ MAX / 2 + 1 ] = { 0 } ;