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.

This page as a plain text file.
%I A120047 #17 Feb 04 2025 01:29:49
%S A120047 0,0,2,37,485,5933,68963,774078,8493366,91683887,977694273,
%T A120047 10327249593,108264085934,1128049914377,11694704489580,
%U A120047 120734708167792,1242063105505230,12739510126065301,130330025583399801
%N A120047 Number of 6-almost primes less than or equal to 10^n.
%e A120047 There are 2 six-almost primes up to 100: 64 and 96, so a(2) = 2.
%t A120047 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 *)
%t A120047 Table[AlmostPrimePi[6, 10^n], {n, 0, 13}]
%o A120047 (Python)
%o A120047 from math import isqrt, prod
%o A120047 from sympy import primerange, integer_nthroot, primepi
%o A120047 def almostprimepi(n,k):
%o A120047     if k==0: return int(n>=1)
%o A120047     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)))
%o A120047     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))
%o A120047 def A120047(n): return almostprimepi(10**n,6) # _Chai Wah Wu_, Dec 09 2024
%Y A120047 Cf. A066265, A014613, A116382.
%Y A120047 Cf. A006880, A036352, A109251, A114106, A114453.
%Y A120047 Cf. A120048, A120049, A120050, A120051, A120052, A120053, A116430.
%K A120047 nonn,more
%O A120047 0,3
%A A120047 _Robert G. Wilson v_, Feb 07 2006
%E A120047 a(14) from _Robert G. Wilson v_, Jan 07 2007
%E A120047 a(15)-a(18) from _Henri Lifchitz_, Feb 03 2025