Re: primepi(2^35)

Loïc Grenié <[email protected]> Tue, 6 Jan 2026 18:42:37 +0100
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <CAMLkfFQ5tN20+0_hfc_O8tjP4vAxO0kJYYM8tuiSrVyC4xXBEw@mail.gmail.com>
On Tue 6 Jan, 2026, at 18:28, Ruud H.G. van Tol wrote:

>
> ? default(primelimit)
> % 2000000000
>
>
> ? primepi(2^35)
> cpu time = 18,133 ms, real time = 18,162 ms.
> % 1480206279
>
> ? primepi(10^11)
> cpu time = 4,744 ms, real time = 4,752 ms.
> % 4118054813
>
>
> Q: Why is the bigger value returned faster?
>

      Because there is a table of precomputed pairs primepi/prime. If you
fall near one
  of the precomputed values, the computation is faster.

          Happy new year,

                  Loïc



>
> ? prime(1480206279)
> cpu time = 18,874 ms, real time = 18,937 ms.
> % 34359738337
>
> ? prime(4118054813)
> cpu time = 4,909 ms, real time = 4,917 ms.
> % 99999999977
>
>
>