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).

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

N. J. A. Sloane, Jun 14 2014

Keywords

Comments

We know from the asymptotic formulas (see Landau) that the sequence is almost always positive.

References

  • E. Landau, Handbuch der Lehre von der Verteilung der Primzahlen, vol. 1, Teubner, Leipzig, 1909; third edition : Chelsea, New York (1974).

Crossrefs

Programs

  • Maple
    g:= proc(n) if isprime(n) then -1 elif numtheory:-bigomega(n) = 2 then 1 else 0 fi end proc:
    ListTools:-PartialSums(map(g, [$1..100])); # Robert Israel, Dec 20 2022
  • Mathematica
    Accumulate[Table[Which[PrimeQ[n],-1,PrimeOmega[n]==2,1,True,0],{n,1000}]] (* Harvey P. Dale, Jun 15 2014 *)
  • PARI
    a(n) = #select(x->(bigomega(x) == 2), [1..n]) - primepi(n); \\ Michel Marcus, Dec 20 2022
    
  • Python
    from math import isqrt
    from sympy import prime, primepi
    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

Formula

a(n) = A072000(n) - A000720(n). - Michel Marcus, Dec 20 2022