%I #29 Oct 18 2024 11:43:04
%S 105,165,195,231,255,273,285,345,357,385,399,429,435,455,465,483,555,
%T 561,595,609,615,627,645,651,663,665,705,715,741,759,777,795,805,861,
%U 885,897,903,915,935,957,969,987,1001,1005,1015,1023,1045,1065,1085
%N Products of exactly three distinct odd primes.
%C The old name was "Odd numbers with exactly 3 distinct prime factors", which is slightly ambiguous, since it might be interpreted to include 315 = 3^2*5*7. Cf. A278569. - _N. J. A. Sloane_, Nov 27 2016
%H T. D. Noe, <a href="/A046389/b046389.txt">Table of n, a(n) for n=1..1000</a>
%t f[n_] := OddQ[n] && Last/@FactorInteger[n]=={1,1,1}; lst={}; Do[If[f[n], AppendTo[lst,n]], {n, 2000}]; lst (* _Vladimir Joseph Stephan Orlovsky_, Nov 23 2009 *)
%o (PARI) list(lim)=my(v=List(), t); forprime(p=3, lim^(1/3), forprime(q=p+1, sqrt(lim\p), t=p*q; forprime(r=q+1, lim\t, listput(v, t*r)))); vecsort(Vec(v)) \\ _Charles R Greathouse IV_, Jul 26 2011
%o (Python)
%o from math import isqrt
%o from sympy import primepi, integer_nthroot, primerange
%o def A046389(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(3,integer_nthroot(x,3)[0]+1),2) for b,m in enumerate(primerange(k+1,isqrt(x//k)+1),a+1)))
%o return bisection(f,n,n) # _Chai Wah Wu_, Sep 10 2024
%Y Cf. A046316, A046405, A007304, A278569.
%K nonn
%O 1,1
%A _Patrick De Geest_, Jun 15 1998
%E Name clarified by _N. J. A. Sloane_, Nov 27 2016