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
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, 18, 18, 22, 20, 20, 24, 22, 22, 26, 24, 24, 28, 26, 26, 30, 28, 28, 32, 30, 30, 34, 32, 32, 36, 34, 34, 38, 36, 36, 40, 38, 38, 42, 40, 40, 44, 42 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
FORMULA
From Colin Barker, Nov 19 2015: (Start)
a(n) = a(n-3) + 2 for n>2.
a(n) = a(n-1) + a(n-3) - a(n-4) for n>3.
G.f.: 2*x^2*(2 - x) / ((1 - x)^2*(1 + x + x^2)). (End)
a(n) = (2/3)*(1 + n - (1 + n mod 3)*(-1)^(-n mod 3)). [Bruno Berselli, Nov 19 2015]
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
MATHEMATICA
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 *)
LinearRecurrence[{1, 0, 1, -1}, {0, 0, 4, 2}, 70] (* Harvey P. Dale, Jan 20 2020 *)
PROG
(PARI) a(n)=if(n<2, 0, 2*n-a(n-1)-a(n-2))
(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
(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
(Magma) [(2/3)*(1+n-(1+n mod 3)*(-1)^(-n mod 3)): n in [0..70]]; // Bruno Berselli, Nov 19 2015
CROSSREFS
Sequence in context: A199609 A284692 A019834 * A270809 A087507 A020777
KEYWORD
nonn,easy
AUTHOR
Anders Hellström, Nov 18 2015
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.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 17:39 EDT 2024. Contains 371797 sequences. (Running on oeis4.)