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

前端 未结 7 1776
醉话见心
醉话见心 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:37

    My Best Prime(n) Estimate

    1/2*(8-8.7*n-n^2+
    1/2*(2*abs(log(n)/log(3)+log(log(n)/log(2))/log(2))+
    abs((log(log(3))-log(log(n))+2*n*log(log(n)/log(2))+
    sqrt(((8*log(3)*log(n))/log(2)-log(log(2))+
    log(log(n)))*log(log(n)/log(2))))/log(log(n)/log(2))))*(-1+
    abs(log(n)/log(3)+log(log(n)/log(2))/log(2))+abs(-(1/2)+n+
    sqrt(((8*log(3)*log(n))/log(2)-log(log(2))+
    log(log(n)))*log(log(n)/log(2)))/(2*log(log(n)/log(2))))))
    

    Here's my most recent more experimental formula. btw. The ten trillionth prime is 323,780,508,946,331 this formula works quite well at that scale not sure if it continues to get closer than n*ln(n)+n*(ln(ln(n))-0.9385).

    1/2*(3-(8+ln(2.3))*n-n^2+1/2*(-1+
    abs(-(1/2)+n+sqrt(ln(ln(n)/ln(2))*(-ln(ln(2))+ln(ln(n))+
    (8*ln(3)*ln((n*ln(8*n))/ln(n)))/ln(2)))/(2*ln(ln((n*ln(8*n))/
    ln(n))/ln(2))))+abs(ln(n)/ln(3)+ln(ln((n*ln(8*n))/ln(n))/ln(2))/
    ln(2)))*(2*abs(ln((n*ln(8*n))/ln(n))/ln(3)+ln(ln((n*ln(8*n))/ln(n))/
    ln(2))/ln(2))+abs(1/ln(ln(n)/ln(2))*(ln(ln(3))-ln(ln(n))+2*n*ln(ln(n)/
    ln(2))+sqrt(((8*ln(3)*ln(n))/ln(2)-ln(ln(2))+ln(ln((n*ln(8*n))/ln(n))))*
    ln(ln((n*ln(8*n))/ln(n))/ln(2)))))))
    

提交回复
热议问题