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.

A128918 a(n) = n*(n+1)/2 if n is odd, otherwise (n-1)*n/2 + 1.

This page as a plain text file.
%I A128918 #36 May 24 2022 10:00:21
%S A128918 1,1,2,6,7,15,16,28,29,45,46,66,67,91,92,120,121,153,154,190,191,231,
%T A128918 232,276,277,325,326,378,379,435,436,496,497,561,562,630,631,703,704,
%U A128918 780,781,861,862,946,947,1035,1036,1128,1129,1225,1226,1326,1327,1431,1432,1540
%N A128918 a(n) = n*(n+1)/2 if n is odd, otherwise (n-1)*n/2 + 1.
%H A128918 Reinhard Zumkeller, <a href="/A128918/b128918.txt">Table of n, a(n) for n = 0..10000</a>
%H A128918 <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,2,-2,-1,1).
%F A128918 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
%F A128918 a(n) = (1/2)*(-1)^n*(n+(-1)^n*((n-2)*n+2)-2). - _Harvey P. Dale_, Mar 31 2012
%F A128918 a(2*n) = A130883(n); a(2*n+1) = A000384(n+1). - _Reinhard Zumkeller_, Oct 12 2013
%F A128918 G.f.: (1 - x^2 + 4*x^3) / ((1 - x)^3*(1 + x)^2). - _Colin Barker_, Jan 20 2018
%p A128918 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
%t A128918 Table[If[OddQ[n],(n(n+1))/2,(n(n-1))/2+1],{n,0,60}] (* or *)
%t A128918 LinearRecurrence[{1,2,-2,-1,1},{1,1,2,6,7},60] (* _Harvey P. Dale_, Mar 31 2012 *)
%t A128918 CoefficientList[ Series[(-4x^3 + x^2 -1)/((x -1)^3 (x + 1)^2), {x, 0, 55}], x] (* _Robert G. Wilson v_, Jan 20 2018 *)
%o A128918 (Haskell)
%o A128918 a128918 n = (n + m - 1) * n' + m * n - m + 1  where (n', m) = divMod n 2
%o A128918 -- _Reinhard Zumkeller_, Oct 12 2013
%o A128918 (PARI) a(n)=if(n%2,n*(n+1),(n-1)*n+2)/2 \\ _Charles R Greathouse IV_, Oct 16 2015
%o A128918 (PARI) Vec((1 - x^2 + 4*x^3) / ((1 - x)^3*(1 + x)^2) + O(x^40)) \\ _Colin Barker_, Jan 20 2018
%o A128918 (Python)
%o A128918 def A128918(n): return n*(n-1)//2 + 1 + (n-1)*(n%2) # _Chai Wah Wu_, May 24 2022
%Y A128918 Cf. A000384, A130883, A131179.
%K A128918 nonn,easy
%O A128918 0,3
%A A128918 _N. J. A. Sloane_, Sep 26 2007