OFFSET
1,2
COMMENTS
The nonzero subsequence of A123074.
PROG
(Python)
from math import isqrt
from sympy import primepi, primerange, integer_nthroot, primefactors
def A123073(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 for a, k in enumerate(primerange(integer_nthroot(x, 3)[0]+1)) for b, m in enumerate(primerange(k, isqrt(x//k)+1), a)))
return (1, 3, 6)[len(primefactors(bisection(f, n, n)))-1] # Chai Wah Wu, Oct 20 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane and T. D. Noe, Sep 29 2006
EXTENSIONS
More terms from T. D. Noe, Sep 29 2006
STATUS
approved