login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A082997
a(n) = card{ x <= n : omega(x) = 2 }.
6
0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5, 5, 5, 6, 6, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 12, 13, 14, 15, 16, 16, 17, 18, 19, 19, 19, 19, 20, 21, 22, 22, 23, 23, 24, 25, 26, 26, 27, 28, 29, 30, 31, 31, 31, 31, 32, 33, 33, 34, 34, 34, 35, 36, 36, 36, 37, 37, 38, 39, 40, 41
OFFSET
1,10
REFERENCES
G. Tenenbaum, Introduction à la théorie analytique et probabiliste des nombres, p. 203, Publications de l'Institut Cartan, 1990.
LINKS
FORMULA
a(n) ~ (n/log(n))*log(log(n)).
a(A007774(n)) = n. - Daniel Suteu, Jul 21 2021
MAPLE
a:= proc(n) option remember; `if`(n=0, 0,
a(n-1)+`if`(nops(ifactors(n)[2])=2, 1, 0))
end:
seq(a(n), n=1..100); # Alois P. Heinz, Aug 23 2021
MATHEMATICA
a[n_] := Count[PrimeNu[Range[n]], 2];
Array[a, 100] (* Jean-François Alcover, Mar 02 2022 *)
PROG
(PARI) a(n)=sum(i=1, n, if(omega(i)-2, 0, 1))
(PARI) a(n) = my(s = sqrtint(n), p = 2, j = 1, count = 0); while(p <= s, my(r = nextprime(p+1)); my(t = p); while (t <= n, my(w = n\t); if(r > w, break); count += primepi(w) - j; my(r2 = r); while(r2 <= w, my(u = t*r2*r2); if(u > n, break); while (u <= n, count += 1; u *= r2); r2 = nextprime(r2+1)); t *= p); p = r; j += 1); count; \\ Daniel Suteu, Jul 21 2021
(Python)
from sympy import factorint
from itertools import accumulate
def cond(n): return int(len(factorint(n))==2)
def aupto(nn): return list(accumulate(map(cond, range(1, nn+1))))
print(aupto(77)) # Michael S. Branicky, Jul 21 2021
CROSSREFS
Partial sums of A215480.
Sequence in context: A194249 A285759 A365740 * A085970 A355538 A238884
KEYWORD
nonn
AUTHOR
Benoit Cloitre, May 30 2003
STATUS
approved