Is there a way to find the approximate value of the nth prime?

前端 未结 7 1774
醉话见心
醉话见心 2020-12-14 10:09

Is there a function which will return the approximate value of the n th prime? I think this would be something like an approximate inverse prime counting function.

7条回答
  •  难免孤独
    2020-12-14 10:46

    An efficient implementation is probably not possible with a sieve. Think what would happen if you want to have the first 10.000 prime numbers. You probably would have to make a sieve over a huge bigger amount of numbers.

    Your own implentation in this question and my answer are good ways to implement this without knowing the appr. value of a prime

提交回复
热议问题