OFFSET
1,1
COMMENTS
Subset of A113877.
LINKS
Christian N. K. Anderson, Table of n, a(n) for n = 1..9006, for a(n) < 1.5*10^18
EXAMPLE
6561=9^4, and 9 and 4 are both semiprime. 46656 = 6^6 is excluded because the semiprimes are not distinct.
PROG
(Python)
from math import isqrt
from sympy import primepi, primerange, integer_nthroot, factorint
def A217908(n):
def A072000(n): return int(-((t:=primepi(s:=isqrt(n)))*(t-1)>>1)+sum(primepi(n//p) for p in primerange(s+1)))
def f(x): return int(n+x-sum(A072000(integer_nthroot(x, p)[0])-(p**p<=x) for p in range(4, x.bit_length()) if sum(factorint(p).values())==2))
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
return bisection(f, n, n) # Chai Wah Wu, Sep 12 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Kevin L. Schwartz and Christian N. K. Anderson, Mar 25 2013
STATUS
approved