This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A319674 a(n) = 1 + 2 + 3 - 4 - 5 - 6 + 7 + 8 + 9 - 10 - 11 - 12 + ... - (up to n). 1
 1, 3, 6, 2, -3, -9, -2, 6, 15, 5, -6, -18, -5, 9, 24, 8, -9, -27, -8, 12, 33, 11, -12, -36, -11, 15, 42, 14, -15, -45, -14, 18, 51, 17, -18, -54, -17, 21, 60, 20, -21, -63, -20, 24, 69, 23, -24, -72, -23, 27, 78, 26, -27, -81, -26, 30, 87, 29, -30, -90, -29 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,2 COMMENTS In general, for sequences that add the first k natural numbers and then subtract the next k natural numbers, and continue to alternate in this way up to n, we have a(n) = Sum_{i=1..n} i*(-1)^floor((i-1)/k). Here, k=3. LINKS Colin Barker, Table of n, a(n) for n = 1..1000 Index entries for linear recurrences with constant coefficients, signature (1,0,-2,2,0,-1,1). FORMULA a(n) = Sum_{i=1..n} i*(-1)^floor((i-1)/3). From Colin Barker, Sep 26 2018: (Start) G.f.: x*(1 + 2*x + 3*x^2 - 2*x^3 - x^4) / ((1 - x)*(1 + x)^2*(1 - x + x^2)^2). a(n) = a(n-1) - 2*a(n-3) + 2*a(n-4) - a(n-6) + a(n-7) for n>7. (End) EXAMPLE a(1) = 1; a(2) = 1 + 2 = 3; a(3) = 1 + 2 + 3 = 6; a(4) = 1 + 2 + 3 - 4 = 2; a(5) = 1 + 2 + 3 - 4 - 5 = -3; a(6) = 1 + 2 + 3 - 4 - 5 - 6 = -9; a(7) = 1 + 2 + 3 - 4 - 5 - 6 + 7 = -2; a(8) = 1 + 2 + 3 - 4 - 5 - 6 + 7 + 8 = 6; a(9) = 1 + 2 + 3 - 4 - 5 - 6 + 7 + 8 + 9 = 15; a(10) = 1 + 2 + 3 - 4 - 5 - 6 + 7 + 8 + 9 - 10 = 5; etc. MATHEMATICA Table[Sum[i (-1)^Floor[(i - 1)/3], {i, n}], {n, 60}] PROG (PARI) Vec(x*(1 + 2*x + 3*x^2 - 2*x^3 - x^4) / ((1 - x)*(1 + x)^2*(1 - x + x^2)^2) + O(x^60)) \\ Colin Barker, Sep 26 2018 CROSSREFS Cf. A001057 (k=1), A077140 (k=2), this sequence (k=3). Sequence in context: A021280 A282728 A193537 * A021738 A016614 A019769 Adjacent sequences:  A319671 A319672 A319673 * A319675 A319676 A319677 KEYWORD sign,easy AUTHOR Wesley Ivan Hurt, Sep 25 2018 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 August 18 00:56 EDT 2019. Contains 326059 sequences. (Running on oeis4.)