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.

A383037 a(n) is the excess of composites over primes in the first n odd positive integers.

Original entry on oeis.org

0, -1, -2, -3, -2, -3, -4, -3, -4, -5, -4, -5, -4, -3, -4, -5, -4, -3, -4, -3, -4, -5, -4, -5, -4, -3, -4, -3, -2, -3, -4, -3, -2, -3, -2, -3, -4, -3, -2, -3, -2, -3, -2, -1, -2, -1, 0, 1, 0, 1, 0, -1, 0, -1, -2, -1, -2, -1, 0, 1, 2, 3, 4, 3, 4, 3, 4, 5, 4, 3, 4
Offset: 1

Views

Author

Felix Huber, Apr 19 2025

Keywords

Examples

			Of the first 5 odd positive integers (1, 3, 5, 7, 9), one (9) is a composite and three (3, 5, 7) are primes, so a(5) = 1 - 3 = -2.
		

Crossrefs

Programs

  • Maple
    A383037:=n->n-NumberTheory:-pi(2*n)*2+1;seq(A383037(n),n=1..71);
  • Mathematica
    a[n_]:=n - 2*PrimePi[2*n] + 1; Array[a,71] (* Stefano Spezia, Apr 20 2025 *)

Formula

a(n) = n - 2*pi(2*n) + 1.
a(n) = A210469(n) - pi(2*n) + 1 = A210469(n) - A000720(2*n) + 1 = for n > 1.
a(n) = A118777(2*n-1) - n + 1 for n > 1.
a(n) = A097454(2*n-1) - n + 2 for n > 1.
a(n) = A072731(2*n-1) - n + 3 for n > 1.