login
A078846
Where 11^n occurs in n-almost-primes, starting at a(0)=1.
16
1, 5, 40, 328, 2556, 18452, 126096, 827901, 5276913, 32887213, 201443165, 1217389949, 7279826998, 43168558912, 254258462459, 1489291941733, 8683388113017, 50433408838966
OFFSET
0,2
COMMENTS
A k-almost-prime is a positive integer that has exactly k prime factors, counted with multiplicity.
LINKS
Eric Weisstein's World of Mathematics, Almost Prime.
EXAMPLE
a(2) = 40 since 11^2 is the 40th 2-almost-prime: A001358(40) = 121.
MATHEMATICA
AlmostPrimePi[k_Integer /; k > 1, n_] := Module[{a, i}, a[0] = 1; 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}]]]]; (* Eric W. Weisstein, Feb 07 2006 *)
Table[ AlmostPrimePi[n, 11^n], {n, 2, 11}] (* Robert G. Wilson v, Feb 09 2006 *)
PROG
(PARI)
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);
a(n) = if(n == 0, 1, almost_prime_count(11^n, n)); \\ Daniel Suteu, Jul 10 2023
(Python)
from math import isqrt, prod
from sympy import primerange, integer_nthroot, primepi
def A078846(n):
def almostprimepi(n, k):
def g(x, a, b, c, m): yield from (((d, ) for d in enumerate(primerange(b, isqrt(x//c)+1), a)) if m==2 else (((a2, b2), )+d for a2, b2 in enumerate(primerange(b, integer_nthroot(x//c, m)[0]+1), a) for d in g(x, a2, b2, c*b2, m-1)))
return int(sum(primepi(n//prod(c[1] for c in a))-a[-1][0] for a in g(n, 0, 1, 1, k)) if k>1 else primepi(n))
return almostprimepi(11**n, n) if n else 1 # Chai Wah Wu, Sep 01 2024
CROSSREFS
KEYWORD
more,nonn
AUTHOR
Benoit Cloitre and Paul D. Hanna, Dec 10 2002
EXTENSIONS
a(6)-a(11) from Robert G. Wilson v, Feb 09 2006
a(12)-a(15) from Donovan Johnson, Sep 27 2010
a(16)-a(17) from Daniel Suteu, Jul 10 2023
STATUS
approved