Improve speed of finding Nth prime