OPTIMIZED SIEVE, BINARY SEARCH