calculate nth prime