cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A120047 Number of 6-almost primes less than or equal to 10^n.

Original entry on oeis.org

0, 0, 2, 37, 485, 5933, 68963, 774078, 8493366, 91683887, 977694273, 10327249593, 108264085934, 1128049914377, 11694704489580, 120734708167792, 1242063105505230, 12739510126065301, 130330025583399801
Offset: 0

Views

Author

Robert G. Wilson v, Feb 07 2006

Keywords

Examples

			There are 2 six-almost primes up to 100: 64 and 96, so a(2) = 2.
		

Crossrefs

Programs

  • Mathematica
    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}]]]]]; (* Eric W. Weisstein, Feb 07 2006 *)
    Table[AlmostPrimePi[6, 10^n], {n, 0, 13}]
  • Python
    from math import isqrt, prod
    from sympy import primerange, integer_nthroot, primepi
    def almostprimepi(n,k):
        if k==0: return int(n>=1)
        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))
    def A120047(n): return almostprimepi(10**n,6) # Chai Wah Wu, Dec 09 2024

Extensions

a(14) from Robert G. Wilson v, Jan 07 2007
a(15)-a(18) from Henri Lifchitz, Feb 03 2025