Ruud H.G. van Tol on Fri, 02 Feb 2024 04:23:07 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: primepi([from,until])
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: primepi([from,until])
- From: "Ruud H.G. van Tol" <rvtol@isolution.nl>
- Date: Fri, 2 Feb 2024 04:22:58 +0100
- Delivery-date: Fri, 02 Feb 2024 04:23:07 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=isolution.nl; s=soverin; t=1706844181; bh=cB1DviiHbmgUbQkUD5dh7PCsJyY5PA9HV1irzWSbb3k=; h=Date:Subject:To:References:From:In-Reply-To:From; b=QCtyosHDIPVnsrtEIzqM+nSmXKRoDufo8dk5QsUo6TxxZM2FgQo6S6CxVknsLlmQ/ EwLUNoB0+p/4E3GlYjtVLfdmwYBfAHy/N6YZWOveRbu4E4C5y4CxCnx3M7FUbxKo0Q odV5jaMbTLxMB9ipmHbFeADUEj2FnOvPikoTZTl2cQG/yHi4OJNDdkbF/H+ezrF7JY +ZOE5hChMe3qjTv72IYokEk3E29wxjAJOB4cY8Slf+bWDkaYiWPayuKqa34EVRdfNM AU7ifD+K982fp3raANVlxr1+MekfvmATYFeh7Vvlw0Mh3YLHC3Jo/LYj1dOMU6Or3X FOIFptqyw48hQ==
- In-reply-to: <Zbv7st/VF+x7AaIH@seventeen>
- References: <eea41fa1-7ed8-442c-a395-17a3cc7dcb47@isolution.nl> <Zbv7st/VF+x7AaIH@seventeen>
On 2024-02-01 21:14, Bill Allombert wrote:
On Thu, Feb 01, 2024 at 09:08:00PM +0100, Ruud H.G. van Tol wrote:
I'm adding
a(n) = #primes( [ n^2/4, (n+1)^2/4 ] );
to https://oeis.org/A220492
and was wondering if primepi() should grow a primepi([x1, x2]) variant,
to return the number of primes p, x1 <= p <= x2.
just do primepi(floor(x2))- primepi(ceil(x1)-1) or something ?
a(n) = #primes( [ n^2/4, (n+1)^2/4 ] )
? a( prime(2^16) );
cpu time = 3 ms, real time = 3 ms.
a1(n) = primepi((n+1)^2/4) - primepi(n^2/4)
? a1( prime(2^16) );
cpu time = 1min, 12,013 ms, real time = 1min, 12,437 ms.
So for this case, the primepi-delta-version is much slower.
-- Ruud