login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A138189 Sequence built on pattern (1,-even,-even) beginning 1,-2,-2. 1

%I

%S 1,-2,-2,1,-4,-4,1,-6,-6,1,-8,-8,1,-10,-10,1,-12,-12,1,-14,-14,1,-16,

%T -16,1,-18,-18,1,-20,-20,1,-22,-22,1,-24,-24,1,-26,-26,1,-28,-28,1,

%U -30,-30,1,-32,-32,1,-34,-34,1,-36,-36,1,-38,-38,1,-40,-40

%N Sequence built on pattern (1,-even,-even) beginning 1,-2,-2.

%C Partial sums of A138188.

%H G. C. Greubel, <a href="/A138189/b138189.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,2,0,0,-1).

%F G.f.: (1 -2*x -2*x^2 -x^3)/(1 -2*x^3 +x^6).

%F From _G. C. Greubel_, Jun 16 2021: (Start)

%F 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 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 Join[{1},Riffle[Flatten[{-2#,-2#}&/@Range[25]],1,3]] (* _Harvey P. Dale_, Nov 02 2011 *)

%o (MAGMA)

%o 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:= func< n | -b[n+3] >;

%o [A138189(n): n in [0..100]]; // _G. C. Greubel_, Jun 16 2021

%o (Sage)

%o @CachedFunction

%o def A138189(n):

%o if (n%3==0): return 1

%o elif (n%3==1): return -2*(n//3 +1)

%o else: return -2*(n//3 +1)

%o [A138189(n) for n in (0..100)] # _G. C. Greubel_, Jun 16 2021

%Y Cf. A110090, A138188.

%K easy,sign,changed

%O 0,2

%A _Paul Barry_, Mar 04 2008

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.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 22 07:09 EDT 2021. Contains 345374 sequences. (Running on oeis4.)