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.

A116568 Difference between n and the absolute value of the difference between number of nonprimes not exceeding n and number of primes not exceeding n.

Original entry on oeis.org

0, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 10, 12, 12, 12, 12, 14, 14, 16, 16, 16, 16, 18, 18, 18, 18, 18, 18, 20, 20, 22, 22, 22, 22, 22, 22, 24, 24, 24, 24, 26, 26, 28, 28, 28, 28, 30, 30, 30, 30, 30, 30, 32, 32, 32, 32, 32, 32, 34, 34, 36, 36, 36, 36, 36, 36, 38, 38, 38, 38, 40, 40, 42
Offset: 1

Views

Author

Roger L. Bagula, Mar 18 2006

Keywords

Examples

			a(11)=10 because the nonprimes not exceeding 11 are 1,4,6,8,9 and 10, the primes not exceeding 11 are 2,3,5,7 and 11 and 11-abs(6-5)=10.
		

Crossrefs

Cf. A097454.

Programs

  • Maple
    with(numtheory): seq(n-abs(n-2*pi(n)),n=1..73);
  • Mathematica
    Table[n-Abs[2*PrimePi[n]-n],{n,80}] (* Harvey P. Dale, Oct 08 2015 *)
  • PARI
    for(n=1,50, print1(n - abs(2*primepi(n) - n) , ", ")) \\ G. C. Greubel, Sep 20 2017

Formula

a(n) = n - Abs[A097454(n)].

Extensions

Edited by N. J. A. Sloane, Apr 05 2006