updated primes calculation