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.

Original entry on oeis.org

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, 20, 22, 22, 23, 24, 25, 25, 26, 26, 27, 28, 29, 29, 31, 31, 33, 34, 34, 35, 37, 38, 38, 39, 39, 39, 41, 41, 41, 42, 42, 43, 45, 46, 48, 49, 50, 50, 51, 51, 53, 54
Offset: 1

Views

Author

Wesley Ivan Hurt, May 09 2019

Keywords

Comments

For n > 1, a(n) is the number of composites in the closed interval [n+1, 2n-1].
a(n) is also the number of composites appearing among the largest parts of the partitions of 2n into two distinct parts.

Examples

			a(7) = 4; there are 4 composites in the closed interval [8, 13]: 8, 9, 10 and 12.
		

Crossrefs

Related sequences:
Primes (p) and composites (c): A000040, A002808, A000720, A065855.
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.
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.

Programs

  • Maple
    chi := proc(n) if n <= 3 then 0 else n - numtheory:-pi(n) - 1; fi; end; # A065855
    A307912 := proc(n) chi(2*n-1) - chi(n); end;
    A := [seq(A307912(n),n=1..120)]; # N. J. A. Sloane, Oct 20 2024
  • Mathematica
    Table[n - 1 - PrimePi[2 n - 1] + PrimePi[n], {n, 100}]
  • Python
    from sympy import primepi
    def A307912(n): return n+primepi(n)-primepi((n<<1)-1)-1 # Chai Wah Wu, Oct 20 2024

Formula

a(n) = n - 1 - A060715(n).
a(n) = n - 1 - A000720(2*n-1) + A000720(n).