The OEIS is supported by the many generous donors to the OEIS Foundation.

 Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered thanks to the OEIS”). Other ways to Give
 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A128918 a(n) = n*(n+1)/2 if n is odd, otherwise (n-1)*n/2 + 1. 6
 1, 1, 2, 6, 7, 15, 16, 28, 29, 45, 46, 66, 67, 91, 92, 120, 121, 153, 154, 190, 191, 231, 232, 276, 277, 325, 326, 378, 379, 435, 436, 496, 497, 561, 562, 630, 631, 703, 704, 780, 781, 861, 862, 946, 947, 1035, 1036, 1128, 1129, 1225, 1226, 1326, 1327, 1431, 1432, 1540 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,3 LINKS Reinhard Zumkeller, Table of n, a(n) for n = 0..10000 Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1). FORMULA a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3) - a(n-4) + a(n-5), with a(0)=1, a(1)=1, a(2)=2, a(3)=6, a(4)=7. - Harvey P. Dale, Mar 31 2012 a(n) = (1/2)*(-1)^n*(n+(-1)^n*((n-2)*n+2)-2). - Harvey P. Dale, Mar 31 2012 a(2*n) = A130883(n); a(2*n+1) = A000384(n+1). - Reinhard Zumkeller, Oct 12 2013 G.f.: (1 - x^2 + 4*x^3) / ((1 - x)^3*(1 + x)^2). - Colin Barker, Jan 20 2018 MAPLE A128918:=n->`if`((n mod 2) = 1, n*(n+1)/2, (n-1)*n/2+1): seq(A128918(n), n=0..100); # Wesley Ivan Hurt, Feb 03 2017 MATHEMATICA Table[If[OddQ[n], (n(n+1))/2, (n(n-1))/2+1], {n, 0, 60}] (* or *) LinearRecurrence[{1, 2, -2, -1, 1}, {1, 1, 2, 6, 7}, 60] (* Harvey P. Dale, Mar 31 2012 *) CoefficientList[ Series[(-4x^3 + x^2 -1)/((x -1)^3 (x + 1)^2), {x, 0, 55}], x] (* Robert G. Wilson v, Jan 20 2018 *) PROG (Haskell) a128918 n = (n + m - 1) * n' + m * n - m + 1 where (n', m) = divMod n 2 -- Reinhard Zumkeller, Oct 12 2013 (PARI) a(n)=if(n%2, n*(n+1), (n-1)*n+2)/2 \\ Charles R Greathouse IV, Oct 16 2015 (PARI) Vec((1 - x^2 + 4*x^3) / ((1 - x)^3*(1 + x)^2) + O(x^40)) \\ Colin Barker, Jan 20 2018 (Python) def A128918(n): return n*(n-1)//2 + 1 + (n-1)*(n%2) # Chai Wah Wu, May 24 2022 CROSSREFS Cf. A000384, A130883, A131179. Sequence in context: A210660 A344343 A226965 * A078113 A286054 A340376 Adjacent sequences: A128915 A128916 A128917 * A128919 A128920 A128921 KEYWORD nonn,easy AUTHOR N. J. A. Sloane, Sep 26 2007 STATUS approved

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

Last modified December 9 17:12 EST 2022. Contains 358702 sequences. (Running on oeis4.)