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

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A261557 a(0) = a(1) = 0; for n>1, a(n) = 2*n - a(n-1) - a(n-2). 1

%I #33 Sep 08 2022 08:46:13

%S 0,0,4,2,2,6,4,4,8,6,6,10,8,8,12,10,10,14,12,12,16,14,14,18,16,16,20,

%T 18,18,22,20,20,24,22,22,26,24,24,28,26,26,30,28,28,32,30,30,34,32,32,

%U 36,34,34,38,36,36,40,38,38,42,40,40,44,42

%N a(0) = a(1) = 0; for n>1, a(n) = 2*n - a(n-1) - a(n-2).

%H Colin Barker, <a href="/A261557/b261557.txt">Table of n, a(n) for n = 0..1000</a>

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

%F From _Colin Barker_, Nov 19 2015: (Start)

%F a(n) = a(n-3) + 2 for n>2.

%F a(n) = a(n-1) + a(n-3) - a(n-4) for n>3.

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

%F a(n) = (2/3)*(1 + n - (1 + n mod 3)*(-1)^(-n mod 3)). [_Bruno Berselli_, Nov 19 2015]

%F a(n) = (2/9)*(3*n+3+9*cos(2*(n-2)*Pi/3)+sqrt(3)*sin(2*(n-2)*Pi/3)). - _Wesley Ivan Hurt_, Oct 01 2017

%t RecurrenceTable[{a[0] == a[1] == 0, a[n] == 2 n - a[n - 1] - a[n - 2]}, a, {n, 0, 70}] (* _Bruno Berselli_, Nov 19 2015 *)

%t LinearRecurrence[{1,0,1,-1},{0,0,4,2},70] (* _Harvey P. Dale_, Jan 20 2020 *)

%o (PARI) a(n)=if(n<2,0,2*n-a(n-1)-a(n-2))

%o (PARI) first(m)=my(v=vector(m));v[1]=0;v[2]=0;for(i=3,m,v[i]=2*(i-1)-v[i-1]-v[i-2]);v

%o (PARI) concat(vector(2), Vec(-2*x^2*(x-2)/((x-1)^2*(x^2+x+1)) + O(x^100))) \\ _Colin Barker_, Nov 19 2015

%o (Magma) [(2/3)*(1+n-(1+n mod 3)*(-1)^(-n mod 3)): n in [0..70]]; // _Bruno Berselli_, Nov 19 2015

%K nonn,easy

%O 0,3

%A _Anders Hellström_, Nov 18 2015

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.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 04:38 EDT 2024. Contains 371696 sequences. (Running on oeis4.)