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.

A307912 a(n) = n - 1 - pi(2*n-1) + pi(n), where pi is the prime counting function.

This page as a plain text file.
%I A307912 #53 Oct 22 2024 02:58:03
%S A307912 0,0,1,1,3,3,4,5,5,5,7,7,9,10,10,10,12,13,14,15,15,15,17,17,18,19,19,
%T A307912 20,22,22,23,24,25,25,26,26,27,28,29,29,31,31,33,34,34,35,37,38,38,39,
%U A307912 39,39,41,41,41,42,42,43,45,46,48,49,50,50,51,51,53,54
%N A307912 a(n) = n - 1 - pi(2*n-1) + pi(n), where pi is the prime counting function.
%C A307912 For n > 1, a(n) is the number of composites in the closed interval [n+1, 2n-1].
%C A307912 a(n) is also the number of composites appearing among the largest parts of the partitions of 2n into two distinct parts.
%H A307912 N. J. A. Sloane, <a href="/A307912/b307912.txt">Table of n, a(n) for n = 1..20000</a>
%H A307912 <a href="/index/Par#part">Index entries for sequences related to partitions</a>
%F A307912 a(n) = n - 1 - A060715(n).
%F A307912 a(n) = n - 1 - A000720(2*n-1) + A000720(n).
%e A307912 a(7) = 4; there are 4 composites in the closed interval [8, 13]: 8, 9, 10 and 12.
%p A307912 chi := proc(n) if n <= 3 then 0 else n - numtheory:-pi(n) - 1; fi; end; # A065855
%p A307912 A307912 := proc(n) chi(2*n-1) - chi(n); end;
%p A307912 A := [seq(A307912(n),n=1..120)]; # _N. J. A. Sloane_, Oct 20 2024
%t A307912 Table[n - 1 - PrimePi[2 n - 1] + PrimePi[n], {n, 100}]
%o A307912 (Python)
%o A307912 from sympy import primepi
%o A307912 def A307912(n): return n+primepi(n)-primepi((n<<1)-1)-1 # _Chai Wah Wu_, Oct 20 2024
%Y A307912 Related sequences:
%Y A307912 Primes (p) and composites (c): A000040, A002808, A000720, A065855.
%Y A307912 Primes between p(n) and 2*p(n): A063124, A070046; between c(n) and 2*c(n): A376761; between n and 2*n: A035250, A060715, A077463, A108954.
%Y A307912 Composites between p(n) and 2*p(n): A246514; between c(n) and 2*c(n): A376760; between n and 2*n: A075084, A307912, A307989, A376759.
%K A307912 nonn,easy
%O A307912 1,5
%A A307912 _Wesley Ivan Hurt_, May 09 2019