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.

A120042 Number of 11-almost primes 11ap such that 2^n < 11ap <= 2^(n+1).

This page as a plain text file.
%I A120042 #13 Jun 18 2025 00:53:34
%S A120042 0,0,0,0,0,0,0,0,0,0,1,1,5,8,22,47,103,234,490,1078,2261,4844,10294,
%T A120042 21659,45609,95580,200422,417715,871452,1811412,3761623,7798409,
%U A120042 16142081,33373093,68906782,142120436,292797806,602653984,1239225631
%N A120042 Number of 11-almost primes 11ap such that 2^n < 11ap <= 2^(n+1).
%C A120042 The partial sum equals the number of Pi_11(2^n).
%H A120042 Chai Wah Wu, <a href="/A120042/b120042.txt">Table of n, a(n) for n = 0..50</a>
%e A120042 (2^11, 2^12] there is one semiprime, namely 3072. 2048 was counted in the previous entry.
%t A120042 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 A120042 t = Table[AlmostPrimePi[11, 2^n], {n, 0, 30}]; Rest@t - Most@t
%o A120042 (Python)
%o A120042 from math import isqrt, prod
%o A120042 from sympy import primerange, integer_nthroot, primepi
%o A120042 def A120042(n):
%o A120042     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 A120042     def almostprimepi(n, k): 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 A120042     return -almostprimepi(m:=1<<n,11)+almostprimepi(m<<1,11) # _Chai Wah Wu_, Jun 17 2025
%Y A120042 Cf. A069272, A036378, A120033, A120034, A120035, A120036, A120037, A120038, A120039, A120040, A120041, A120042, A120043.
%K A120042 nonn
%O A120042 0,13
%A A120042 _Jonathan Vos Post_ and _Robert G. Wilson v_, Mar 21 2006