Implement efficient reduction for pleasant-looking primes.