Solutions for Prime Mover

View the challenge

This challenge requires you to return the Nth prime number. For example, if the function call is PrimeMover(16) then your program should return 53 because 53 is the 16th prime number. A naive solution to this problem is to loop starting at 2, and at each number in the loop, check to see if it is a prime, if so then we increment a counter until the counter reaches N. This is a valid solution, but it is very slow and actually takes several seconds for the function to run if the input is a large number such as 10504.

You need to be a member to see the rest of this solution and code.