The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A097454 a(n) = (number of nonprimes <= n) - (number of primes <= n). 3
 1, 0, -1, 0, -1, 0, -1, 0, 1, 2, 1, 2, 1, 2, 3, 4, 3, 4, 3, 4, 5, 6, 5, 6, 7, 8, 9, 10, 9, 10, 9, 10, 11, 12, 13, 14, 13, 14, 15, 16, 15, 16, 15, 16, 17, 18, 17, 18, 19, 20, 21, 22, 21, 22, 23, 24, 25, 26, 25, 26, 25, 26, 27, 28, 29, 30, 29, 30, 31, 32, 31, 32, 31, 32, 33, 34, 35, 36, 35, 36, 37, 38, 37, 38, 39, 40, 41, 42, 41, 42, 43, 44, 45 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,10 LINKS FORMULA a(n) = 1 + A072731(n). a(n) = n - 2*pi(n) =  n - 2*A000720(n). - Wesley Ivan Hurt, Jun 16 2013 a(n) - a(n-1) = 1 - 2*A010051(n) for n > 1. - Wesley Ivan Hurt, Dec 18 2018 a(n) = A062298(n) - A000720(n). - Michel Marcus, Jan 31 2019 EXAMPLE a(7) = -1 because there are 3 nonprimes <= 7 (1,4 and 6) and 4 primes <= 7 (2,3,5 and 7). MAPLE with(numtheory): seq(n-2*pi(n), n=1..93); # Emeric Deutsch, Apr 01 2006 MATHEMATICA qp=0; lst={}; Do[If[PrimeQ[n], AppendTo[lst, qp-=1], AppendTo[lst, qp+=1]], {n, 6!}]; lst (* Vladimir Joseph Stephan Orlovsky, Mar 15 2010 *) Accumulate[ -1 + 2 * Boole /@ Not /@ PrimeQ @ Range @ 100] (* Federico Provvedi, Oct 06 2013 *) PROG (PARI) compsmprimes(n) = { for(x=1, n, y=composites(x) - pi(x); print1(y", ") ) } \\ The number of composite numbers less than or equal to n composites(n) = { my(c, x); c=0; for(x=1, n, if(!isprime(x), c++); ); return(c) } \\ pi(x) prime count function pi(n) = { my(c, x); c=0; forprime(x=1, n, c++); return(c) } CROSSREFS Cf. A000720, A010051, A062298, A072731. Sequence in context: A303780 A234022 A261273 * A139803 A058746 A080916 Adjacent sequences:  A097451 A097452 A097453 * A097455 A097456 A097457 KEYWORD sign,easy AUTHOR Cino Hilliard, Aug 23 2004 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified September 16 11:47 EDT 2021. Contains 347472 sequences. (Running on oeis4.)