How to find nth prime with complexity o(1)

The only way to do this in O(1) would be an array of all prime numbers. So, you’d only be able to support a certain number depending on your computer’s memory.

Edit:

There might be some way to compute this involving a bunch of calculus, but that’s beyond me 🙂

Leave a Comment