Only check the primes within bounds suggested
More efficient primality check