%I #47 Nov 09 2024 12:05:51
%S 2,30,288,2600,23313,209867,1903878,17426029,160785135,1493766851,
%T 13959963049,131125938680,1237087821006,11715901643501,
%U 111329815346924,1061057287065814,10139482896634686,97123037634329553,932300026078297246,8966605849186166511,86389956292394285653,833671466547121873095,8056846659972421004731
%N Number of numbers <= 10^n that are products of two distinct primes.
%H <a href="/index/Pri#primepop">Index entries for sequences related to numbers of primes in various ranges</a>
%F a(n) = (1/2)*(pi(10^(n/2)) + Sum_{i=1..pi(10^n)} pi((10^n-1)/P_i)) -1 = Sum_{i=1..pi(sqrt(10^n))} (pi((10^n-1)/P_i) -1) - binomial(pi(sqrt(10^n)), 2). - _Robert G. Wilson v_, May 19 2005
%F a(n) = A036352(n) - A122121(n). - _Robert G. Wilson v_, Feb 07 2012
%t f[n_] := Sum[ PrimePi[n/Prime[i]] - i, {i, PrimePi[ Sqrt[ n]] }]; Table[ f[10^n], {n, 14}] (* _Robert G. Wilson v_, Feb 07 2012 and modified Dec 28 2016 *)
%o (PARI) a(n)=my(s);forprime(p=2,sqrt(10^n),s+=primepi(10^n\p)); s-binomial(primepi(sqrt(10^n))+1,2) \\ _Charles R Greathouse IV_, Apr 23 2012
%o (Python)
%o from math import isqrt
%o from sympy import primepi, primerange
%o def A036351(n): return -(t:=primepi(s:=isqrt(m:=10**n)))-(t*(t-1)>>1)+sum(primepi(m//k) for k in primerange(1, s+1)) # _Chai Wah Wu_, Aug 15 2024
%Y Cf. A066265.
%Y Cf. A036352, A122121.
%K nonn,changed
%O 1,1
%A _Shyam Sunder Gupta_
%E a(14) from _Robert G. Wilson v_, May 19 2005
%E a(15)-a(16) from _Donovan Johnson_, Oct 16 2010
%E Corrected a(15) and a(16) by _Henri Lifchitz_, Nov 11 2012
%E a(17)-a(19) from _Henri Lifchitz_, Nov 11 2012
%E a(20)-a(21) from _Henri Lifchitz_, Jul 03 2015
%E a(22)-a(23) from _Henri Lifchitz_, Nov 09 2024