replace naive primes test