[go: up one dir, main page]

login
A099980
Bisection of A001358.
1
4, 9, 14, 21, 25, 33, 35, 39, 49, 55, 58, 65, 74, 82, 86, 91, 94, 106, 115, 119, 122, 129, 134, 142, 145, 155, 159, 166, 177, 183, 187, 201, 203, 206, 213, 215, 218, 221, 235, 247, 253, 259, 265, 274, 287, 291, 298, 301, 303, 309, 319, 323, 327, 334, 339, 346
OFFSET
0,1
MAPLE
P:=[seq(ithprime(n), n=1..100)]: B:={seq(seq(P[i]*P[j], j=1..100), i=1..100)}:C:={seq(B[k], k=1..140)}: seq(C[2*j-1], j=1..70); # Emeric Deutsch, Dec 14 2004
PROG
(Python)
from math import isqrt
from sympy import primepi, primerange
def A099980(n):
def bisection(f, kmin=0, kmax=1):
while f(kmax) > kmax: kmax <<= 1
while kmax-kmin > 1:
kmid = kmax+kmin>>1
if f(kmid) <= kmid:
kmax = kmid
else:
kmin = kmid
return kmax
def f(x): return int((n<<1)+1+x+((t:=primepi(s:=isqrt(x)))*(t-1)>>1)-sum(primepi(x//p) for p in primerange(s+1)))
return bisection(f, (n<<1)+1, (n<<1)+1) # Chai Wah Wu, Oct 23 2024
CROSSREFS
Cf. A001358.
Sequence in context: A348149 A023488 A115585 * A281314 A004630 A073497
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Nov 19 2004
EXTENSIONS
More terms from Emeric Deutsch, Dec 14 2004
STATUS
approved