trying to make in better for sorted list of primes