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.

Showing 1-3 of 3 results.

A066265 a(n) = number of semiprimes < 10^n.

Original entry on oeis.org

0, 3, 34, 299, 2625, 23378, 210035, 1904324, 17427258, 160788536, 1493776443, 13959990342, 131126017178, 1237088048653, 11715902308080, 111329817298881, 1061057292827269, 10139482913717352, 97123037685177087, 932300026230174178, 8966605849641219022, 86389956293761485464, 833671466551239927908, 8056846659984852885191
Offset: 0

Views

Author

Patrick De Geest, Dec 10 2001

Keywords

Comments

Apart from the first nonzero term the sequence is identical to A036352. - Hugo Pfoertner, Jul 22 2003

Examples

			Below 10 there are three semiprimes: 4 (2*2), 6 (2*3) and 9 (3*3).
		

Crossrefs

Cf. A001358, A064911, A072000, A036352 (identical starting from a(2)), A220262, A292785.

Programs

  • Mathematica
    f[n_] := Sum[ PrimePi[(10^n - 1)/Prime[i]], {i, PrimePi[ Sqrt[10^n]]}] - Binomial[ PrimePi[ Sqrt[10^n]], 2]; Do[ Print[ f[n]], {n, 0, 14}] (* Robert G. Wilson v, May 16 2005 *)
    SemiPrimePi[n_] := Sum[ PrimePi[n/Prime@ i] - i + 1, {i, PrimePi@ Sqrt@ n}]; Array[ SemiPrimePi[10^# - 1] &, 14, 0] (* Robert G. Wilson v, Jan 21 2015 *)
  • PARI
    a(n)=my(s);forprime(p=2,sqrt(10^n),s+=primepi((10^n-1)\p)); s-binomial(primepi(sqrt(10^n)),2) \\ Charles R Greathouse IV, Apr 23 2012
    
  • Perl
    use Math::Prime::Util qw/:all/; use integer; sub countsp { my($k,$sum,$pc)=($[0]-1,0,1); prime_precalc(60_000_000); forprimes { $sum += prime_count($k/$) + 1 - $pc++; } int(sqrt($k)); $sum; } foreach my $n (0..16) { say "$n: ", countsp(10**$n); } # Dana Jacobsen, May 11 2014
    
  • Python
    from math import isqrt
    from sympy import primepi, primerange
    def A066265(n): return int((-(t:=primepi(s:=isqrt(m:=10**n)))*(t-1)>>1)+sum(primepi(m//k) for k in primerange(1, s+1))) if n>1 else 3*n # Chai Wah Wu, Aug 16 2024

Formula

(1/2)*( pi(10^(n/2)) + Sum_{i=1..pi(10^n)} pi( (10^n-1)/P_i) ) = Sum_{i=1..pi(sqrt(10^n))} pi( (10^n-1)/P_i ) - binomial( pi(sqrt(10^n)), 2). - Robert G. Wilson v, May 16 2005

Extensions

More terms from Hugo Pfoertner, Jul 22 2003
a(14) from Robert G. Wilson v, May 16 2005
a(15)-a(16) from Donovan Johnson, Mar 18 2010
a(17)-a(18) from Dana Jacobsen, May 11 2014
a(19)-a(21) from Henri Lifchitz, Jul 04 2015
a(22)-a(23) from Henri Lifchitz, Nov 09 2024

A085770 Number of odd semiprimes < 10^n. Number of terms of A046315 < 10^n.

Original entry on oeis.org

0, 1, 19, 204, 1956, 18245, 168497, 1555811, 14426124, 134432669, 1258822220, 11840335764, 111817881036, 1059796387004, 10076978543513, 96091983644261, 918679875630905, 8803388145953381, 84537081118605467, 813340036541900706, 7838825925851034479, 75669246175972479567
Offset: 0

Views

Author

Hugo Pfoertner, Jul 22 2003

Keywords

Examples

			a(1)=1 because A046315(1)=9=3*3 is the only odd semiprime < 10^1,
a(2)=19 because there are 19 terms of A046315 < 10^2.
		

Crossrefs

Cf. A046315 (odd numbers divisible by exactly 2 primes), A066265 (number of semiprimes < 10^n), A220262, A292785.

Programs

  • Mathematica
    OddSemiPrimePi[n_] := Sum[ PrimePi[n/Prime@i] - i + 1, {i, 2, PrimePi@ Sqrt@ n}]; Table[ OddSemiPrimePi[10^n], {n, 14}] (* Robert G. Wilson v, Feb 02 2006 *)
  • Python
    from math import isqrt
    from sympy import primepi, primerange
    def A085770(n): return int((-(t:=primepi(s:=isqrt(m:=10**n)))*(t-1)>>1)+sum(primepi(m//k) for k in primerange(3, s+1))) if n>1 else n # Chai Wah Wu, Oct 17 2024

Formula

a(n) = A066265(n) - A220262(n) for n > 1. - Jinyuan Wang, Jul 30 2021

Extensions

a(10)-a(14) from Robert G. Wilson v, Feb 02 2006
a(15)-a(16) from Donovan Johnson, Mar 18 2010
a(0) inserted by and a(17)-a(21) from Jinyuan Wang, Jul 30 2021

A378905 a(n) is the number of odd squarefree semiprimes (A046388) < prime(n).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 4, 5, 5, 5, 6, 8, 8, 9, 10, 10, 11, 11, 13, 16, 16, 16, 16, 16, 17, 20, 21, 22, 22, 25, 25, 26, 28, 28, 28, 29, 29, 32, 32, 32, 32, 36, 41, 41, 41, 41, 43, 43, 45, 46, 47, 49, 49, 49, 49, 49, 51, 56, 57, 57, 57, 62, 63, 65, 65, 65, 66
Offset: 1

Views

Author

Hugo Pfoertner, Dec 22 2024

Keywords

Examples

			a(11) = 2 because 15 and 21 are the 2 terms of A046388 < prime(11) = 31;
a(12) = 4: 2 additional terms 33 and 35 of A046388 are < prime(12) = 37.
		

Crossrefs

Programs

  • Mathematica
    nn = 360; c = 0; n = 1; {0}~Join~Reap[Until[n > nn, If[And[SquareFreeQ[n], PrimeNu[n] == 2], c++]; If[PrimeQ[n], Sow[c]]; n += 2] ][[-1, 1]] (* Michael De Vlieger, Dec 22 2024 *)
  • Python
    from math import isqrt
    from sympy import primepi, prime, primerange
    def A378905(n): return 0 if n<3 else int(1-((t:=primepi(s:=isqrt(p:=prime(n))))*(t+1)>>1)+sum(primepi(p//k) for k in primerange(3, s+1))) # Chai Wah Wu, Dec 22 2024
Showing 1-3 of 3 results.