%I #13 Jul 10 2023 19:52:37
%S 1,4,22,125,669,3410,16677,78369,359110,1612613,7133274,31185350,
%T 135062165,580556958,2480278767,10542976739,44626102826,188215850830,
%U 791374442571,3318478309647,13882441625034,57952990683107
%N The number of n-almost primes less than or equal to 8^n, starting with a(0)=1.
%t AlmostPrimePi[k_Integer, n_] := Module[{a, i}, a[0] = 1; If[k == 1, PrimePi[n], Sum[PrimePi[n/Times @@ Prime[ Array[a, k - 1]]] - a[k - 1] + 1, Evaluate[ Sequence @@ Table[{a[i], a[i - 1], PrimePi[(n/Times @@ Prime[Array[a, i - 1]])^(1/(k - i + 1))]}, {i, k - 1}]]]]];
%t Table[ AlmostPrimePi[n, 8^n], {n, 14}] (* _Eric W. Weisstein_, Feb 07 2006 *)
%o (PARI)
%o almost_prime_count(N, k) = if(k==1, return(primepi(N))); (f(m, p, k, j=0) = my(c=0, s=sqrtnint(N\m, k)); if(k==2, forprime(q=p, s, c += primepi(N\(m*q))-j; j += 1), forprime(q=p, s, c += f(m*q, q, k-1, j); j += 1)); c); f(1, 2, k);
%o a(n) = if(n == 0, 1, almost_prime_count(8^n, n)); \\ _Daniel Suteu_, Jul 10 2023
%Y Cf. A078840, A078841, A078842, A116432, A078843, A116426, A078844, A116427, A078845, A116428, A116429, A116430, A078846, A116431.
%K nonn,more
%O 0,2
%A _Robert G. Wilson v_, Feb 14 2006
%E a(15)-a(18) from _Donovan Johnson_, Oct 01 2010
%E a(19)-a(21) from _Daniel Suteu_, Jul 10 2023