Tom Womack on Thu, 25 May 2000 17:22:57 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

This *can't* be missing, can it?


What are the pari names for pi(x) [the inverse function for prime(x)] and
pimax [the largest value for which prime(x) is a precomputed prime]?

It's trivial to write a little binary-search routine

{
pith(x) =
 local(t,l,r);
 t=1;
 while(prime(t)<=x,t=t*2);
 l=t/2;r=t;
 while (r-l>1,m=(l+r)/2;if (prime(m)<=x,l=m,r=m));
 l;
}

but that works badly if X is near enough to primelimit for the first while
loop to overshoot, and feels as if it ought to be a primitive function in
any case.

I'm trying to implement the Buhler-Gross clever algorithm for computing
L^(r)(1) (which requires only sqrt(n) storage to do a sum up to a_n, and so
should converge reasonably for conductors up to O(available storage ^ 4) ),
with the eventual aim of adding an ellanalyticrank(e) function to Pari
[would this be useful functionality?]; this is just the first step to know
how many primes I need to store.

Tom