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.

A243906 (Number of semiprimes <= n) - (number of primes <= n).

This page as a plain text file.
%I A243906 #27 Jul 23 2024 18:50:21
%S A243906 0,-1,-2,-1,-2,-1,-2,-2,-1,0,-1,-1,-2,-1,0,0,-1,-1,-2,-2,-1,0,-1,-1,0,
%T A243906 1,1,1,0,0,-1,-1,0,1,2,2,1,2,3,3,2,2,1,1,1,2,1,1,2,2,3,3,2,2,3,3,4,5,
%U A243906 4,4,3,4,4,4,5,5,4,4,5,5,4,4,3,4,4,4,5,5,4,4,4,5,4,4,5,6,7,7,6,6,7,7,8
%N A243906 (Number of semiprimes <= n) - (number of primes <= n).
%C A243906 We know from the asymptotic formulas (see Landau) that the sequence is almost always positive.
%D A243906 E. Landau, Handbuch der Lehre von der Verteilung der Primzahlen, vol. 1, Teubner, Leipzig, 1909; third edition : Chelsea, New York (1974).
%H A243906 N. J. A. Sloane, <a href="/A243906/b243906.txt">Table of n, a(n) for n = 1..5195</a>
%F A243906 a(n) = A072000(n) - A000720(n). - _Michel Marcus_, Dec 20 2022
%p A243906 g:= proc(n) if isprime(n) then -1 elif numtheory:-bigomega(n) = 2 then 1 else 0 fi end proc:
%p A243906 ListTools:-PartialSums(map(g, [$1..100])); # _Robert Israel_, Dec 20 2022
%t A243906 Accumulate[Table[Which[PrimeQ[n],-1,PrimeOmega[n]==2,1,True,0],{n,1000}]] (* _Harvey P. Dale_, Jun 15 2014 *)
%o A243906 (PARI) a(n) = #select(x->(bigomega(x) == 2), [1..n]) - primepi(n); \\ _Michel Marcus_, Dec 20 2022
%o A243906 (Python)
%o A243906 from math import isqrt
%o A243906 from sympy import prime, primepi
%o A243906 def A243906(n): return int(sum(primepi(n//prime(k))-k+1 for k in range(1,primepi(isqrt(n))+1)))-primepi(n) # _Chai Wah Wu_, Jul 23 2024
%Y A243906 Cf. A243903, A276176.
%Y A243906 Cf. A000720, A072000.
%K A243906 sign
%O A243906 1,3
%A A243906 _N. J. A. Sloane_, Jun 14 2014