improved nth_prime