OFFSET
1,10
REFERENCES
G. Tenenbaum, Introduction à la théorie analytique et probabiliste des nombres, p. 203, Publications de l'Institut Cartan, 1990.
LINKS
Daniel Suteu, Table of n, a(n) for n = 1..10000
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
KEYWORD
nonn
AUTHOR
Benoit Cloitre, May 30 2003
STATUS
approved