This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A051352 a(0) = 0; for n>0, a(n) = a(n-1) + n if n not prime else a(n-1) - n. 3
 0, 1, -1, -4, 0, -5, 1, -6, 2, 11, 21, 10, 22, 9, 23, 38, 54, 37, 55, 36, 56, 77, 99, 76, 100, 125, 151, 178, 206, 177, 207, 176, 208, 241, 275, 310, 346, 309, 347, 386, 426, 385, 427, 384, 428, 473, 519, 472, 520, 569, 619, 670, 722, 669, 723, 778 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,4 COMMENTS Sequence is not monotonic. a(n) = a(n-1) + n * (1 - 2*A010051(n)) = a(n-1) + n * (2*A005171(n) - 1) = a(n-1) + n * (A005171(n) - A010051(n)). - Reinhard Zumkeller, Nov 25 2009 LINKS William A. Tedeschi, Table of n, a(n) for n = 0..10000 FORMULA Difference between sum of composite numbers and prime numbers <= n. - Zak Seidov, Sep 27 2003 MATHEMATICA a[0]=0; a[n_]:=a[n]=If[PrimeQ[n], a[n-1]-n, a[n-1]+n]; Table[a[i], {i, 0, 60}] (* Harvey P. Dale, Apr 07 2011 *) PROG (Haskell) a051352 n = a051352_list !! n a051352_list = 0 : zipWith (+)    (a051352_list) (zipWith (*) [1..] \$ map ((1 -) . (* 2)) a010051_list) -- Reinhard Zumkeller, Jan 02 2015 CROSSREFS Cf. A005171, A010051. Sequence in context: A046779 A255369 A292177 * A239122 A195495 A003816 Adjacent sequences:  A051349 A051350 A051351 * A051353 A051354 A051355 KEYWORD sign,easy,nice AUTHOR Armand Turpel armandt(AT)unforgettable.com 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 July 21 04:40 EDT 2019. Contains 325189 sequences. (Running on oeis4.)