- djbroadhurst wrote:>
>

........

> [N, pi(10^N), R(10^N)]

> [25, 176846309399143769411680, 176846309399141934626966]

For large values of x, this algorithm is inconvenient, eg for x = 10^250 requires over 1868 terms,

>

> where

>

> R(x)=round(1+suminf(k=1,log(x)^k/(zeta(k+1)*k*k!)));

>

Much faster can be calculated as

pi(x) ~= pli(x) = round(Li(x) - 1/2 Li(sqrt(x)))

where Li(x) is the Logarithm integral

pli(10^25) = 176846309399141938590795

(pli(10^25)/R(10^25)) - 1 = 2 10^-17

(pli(10^25)/pi(10^25)) -1 = -1 10^-14

pli{10^250)= 1740206254656916846774941665048386410178028975968929264655269395003484\

7365084787720410883002915274182213664956284195372937010842285191263145\

7678993892420170619475710388189158537825404886895382231933346054713467\

85875358018952542776800464839768387582

--

marian otremba - --- In primenumbers@yahoogroups.com,

Chroma <chromatella@...> wrote:

>> R(x)=round(1+suminf(k=1,log(x)^k/(zeta(k+1)*k*k!)));

No. The Gram formula is still very convenient at this size.

> For large values of x, this algorithm is inconvenient,

> eg for x = 10^250 requires over 1868 terms

Pari-GP, gives the exact value of R(10^250) in 0.1 seconds:

R(x)=round(1+suminf(k=1,log(x)^k/(zeta(k+1)*k*k!)));

{default(realprecision,260);print(R(10^250));

print(" took "gettime" milliseconds");

17402062546569168467749416650483864101780289759689292646552693950034847365084787720410883002915274182213664956284195372937010842285191263145767899389242017061947571038442681072462756632213511422607548574658029047365218974809766827365028215685475746

took 98 milliseconds

Perhaps you are paying for inferior software?

If so, the general rule is: the less you pay,

the better the deal.

Pari-GP is totally free and hence rather hard to beat :-)

David