sieve algorithm for prime calculation