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.
%I A138189 #15 Sep 08 2022 08:45:33 %S A138189 1,-2,-2,1,-4,-4,1,-6,-6,1,-8,-8,1,-10,-10,1,-12,-12,1,-14,-14,1,-16, %T A138189 -16,1,-18,-18,1,-20,-20,1,-22,-22,1,-24,-24,1,-26,-26,1,-28,-28,1, %U A138189 -30,-30,1,-32,-32,1,-34,-34,1,-36,-36,1,-38,-38,1,-40,-40 %N A138189 Sequence built on pattern (1,-even,-even) beginning 1,-2,-2. %C A138189 Partial sums of A138188. %H A138189 G. C. Greubel, <a href="/A138189/b138189.txt">Table of n, a(n) for n = 0..1000</a> %H A138189 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,2,0,0,-1). %F A138189 G.f.: (1 -2*x -2*x^2 -x^3)/(1 -2*x^3 +x^6). %F A138189 From _G. C. Greubel_, Jun 16 2021: (Start) %F A138189 a(n) = -b(n+3), where b(n) = abs(2*b(n-1) - b(n-2)) - b(n-1) - 1 and b(1) = b(2) = 0. %F A138189 a(n) = 1 if (n mod 3) = 0, -2*(floor(n/3) + 1) if (n mod 3) = 1 or (n mod 3) = 2. (End) %t A138189 Join[{1},Riffle[Flatten[{-2#,-2#}&/@Range[25]],1,3]] (* _Harvey P. Dale_, Nov 02 2011 *) %o A138189 (Magma) %o A138189 b:= [n le 2 select 0 else Abs(2*Self(n-1) -Self(n-2)) -Self(n-1)-1: n in [1..120]]; %o A138189 A138189:= func< n | -b[n+3] >; %o A138189 [A138189(n): n in [0..100]]; // _G. C. Greubel_, Jun 16 2021 %o A138189 (Sage) %o A138189 @CachedFunction %o A138189 def A138189(n): %o A138189 if (n%3==0): return 1 %o A138189 elif (n%3==1): return -2*(n//3 +1) %o A138189 else: return -2*(n//3 +1) %o A138189 [A138189(n) for n in (0..100)] # _G. C. Greubel_, Jun 16 2021 %Y A138189 Cf. A110090, A138188. %K A138189 easy,sign %O A138189 0,2 %A A138189 _Paul Barry_, Mar 04 2008