Use partial sieve for next_prime