%I #9 Oct 20 2024 12:38:51
%S 1,3,3,3,1,3,6,6,3,3,3,3,3,6,3,6,3,3,6,3,3,3,6,6,6,6,3,3,3,1,6,6,3,3,
%T 3,6,3,6,6,3,3,6,3,6,6,3,6,6,3,3,6,6,6,3,6,3,3,3,6,6,6,3,6,3,6,3,3,6,
%U 3,6,6,6,3,6,3,6,6,3,3,3,3,1,6,6,3,6,3,6,3,6,6,6,3,3,6,6,3,6,6,3,6,3,3,6,3
%N Number of ordered triples of primes (p,q,r) such that pqr = n-th 3-almost prime A014612(n).
%C The nonzero subsequence of A123074.
%o (Python)
%o from math import isqrt
%o from sympy import primepi, primerange, integer_nthroot, primefactors
%o def A123073(n):
%o def bisection(f,kmin=0,kmax=1):
%o while f(kmax) > kmax: kmax <<= 1
%o while kmax-kmin > 1:
%o kmid = kmax+kmin>>1
%o if f(kmid) <= kmid:
%o kmax = kmid
%o else:
%o kmin = kmid
%o return kmax
%o 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)))
%o return (1,3,6)[len(primefactors(bisection(f,n,n)))-1] # _Chai Wah Wu_, Oct 20 2024
%Y Cf. A123074, A014612.
%K nonn
%O 1,2
%A _N. J. A. Sloane_ and T. D. Noe, Sep 29 2006
%E More terms from _T. D. Noe_, Sep 29 2006