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.

A008508 Number of odd primes less than n-th odd composite number.

This page as a plain text file.
%I A008508 #23 Aug 02 2024 02:01:28
%S A008508 3,5,7,8,8,10,10,11,13,14,14,15,15,17,17,18,20,20,21,22,22,23,23,23,
%T A008508 24,26,28,29,29,29,29,29,29,30,31,31,33,33,33,33,35,35,36,36,37,38,38,
%U A008508 39,39,41,41,41,41,43,45,45,45,45,45,46
%N A008508 Number of odd primes less than n-th odd composite number.
%H A008508 Antti Karttunen, <a href="/A008508/b008508.txt">Table of n, a(n) for n = 1..10000</a>
%F A008508 From _Antti Karttunen_, Apr 17 2015: (Start)
%F A008508 a(n) = A000720(A071904(n)) - 1 (by the definition).
%F A008508 a(n) = A053726(n) - n - 1.
%F A008508 (End)
%e A008508 The first odd composite is 9, and there are 4 primes below: 2, 3, 5, and 7; so there are 3 odd primes, hence a(1)=3.
%t A008508 PrimePi[#] - 1 & /@ Select[Range@ 213, CompositeQ@ # && OddQ@ # &] (* _Michael De Vlieger_, Apr 17 2015 *)
%o A008508 (Scheme, two alternative formulas)
%o A008508 (define (A008508 n) (+ -1 (A000720 (A071904 n))))
%o A008508 (define (A008508 n) (- (A053726 n) n 1))
%o A008508 ;; _Antti Karttunen_, Apr 17 2015
%o A008508 (PARI) lista(nn) = {forcomposite (n=1, nn, if (n % 2, print1(primepi(n)-1, ", ")););} \\ _Michel Marcus_, Apr 18 2015
%o A008508 (Python)
%o A008508 from sympy import primepi
%o A008508 def A008508(n):
%o A008508     if n == 1: return 3
%o A008508     m, k = n, (r:=primepi(n)) + n + (n>>1)
%o A008508     while m != k:
%o A008508         m, k = k, (r:=primepi(k)) + n + (k>>1)
%o A008508     return r-1 # _Chai Wah Wu_, Aug 01 2024
%Y A008508 Cf. A000720, A053726, A071904, A111333.
%K A008508 nonn
%O A008508 1,1
%A A008508 Gary Findley (chfindley(AT)alpha.nlu.edu), Mar 15 1996