OFFSET
1,1
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
PROG
(Haskell)
a046316 n = a046316_list !! (n-1)
a046316_list = filter ((== 3) . a001222) [1, 3 ..]
-- Reinhard Zumkeller, May 05 2015
(PARI) list(lim)=my(v=List(), pq); forprime(p=3, lim\9, forprime(q=3, min(lim\3\p, p), pq=p*q; forprime(r=3, lim\pq, listput(v, pq*r)))); Set(v) \\ Charles R Greathouse IV, Aug 23 2017
(Python)
from math import isqrt
from sympy import primepi, primerange, integer_nthroot
def A046316(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+x-sum(primepi(x//(k*m))-b+1 for a, k in enumerate(primerange(3, integer_nthroot(x, 3)[0]+1), 2) for b, m in enumerate(primerange(k, isqrt(x//k)+1), a)))
return bisection(f, n, n) # Chai Wah Wu, Oct 18 2024
CROSSREFS
A369979 sorted into ascending order.
KEYWORD
nonn,easy
AUTHOR
Patrick De Geest, Jun 15 1998
EXTENSIONS
Definition clarified by N. J. A. Sloane, Dec 19 2017
STATUS
approved