login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A131380
a(3n) = 2n, a(3n+1) = 2n+2, a(3n+2) = 2n+1.
1
0, 2, 1, 2, 4, 3, 4, 6, 5, 6, 8, 7, 8, 10, 9, 10, 12, 11, 12, 14, 13, 14, 16, 15, 16, 18, 17, 18, 20, 19, 20, 22, 21, 22, 24, 23, 24, 26, 25, 26, 28, 27, 28, 30, 29, 30, 32, 31, 32, 34, 33, 34, 36, 35, 36, 38, 37, 38, 40, 39, 40, 42, 41, 42, 44, 43, 44, 46, 45, 46, 48, 47, 48, 50
OFFSET
0,2
FORMULA
G.f.: x*(2-x+x^2)/((x-1)^2*(1+x+x^2)); a(n) = a(n-1)+a(n-3)-a(n-4); a(n) = (-n mod 3) + 2*floor(n/3) = A080425(n) + 2*A002264(n). - Wesley Ivan Hurt, Aug 20 2014
E.g.f.: ((2*z+1)/3)*exp(z)+((5/9)*sqrt(3)*sin(sqrt(3)*z/2)-(1/3)*cos(sqrt(3)*z/2))*exp(-z/2). - Robert Israel, Aug 21 2014
a(n) = (6*n+3-6*cos(2*(n+4)*Pi/3)-4*sqrt(3)*sin(2*(n+4)*Pi/3))/9. - Wesley Ivan Hurt, Sep 26 2017
MAPLE
A131380:=n->(-n mod 3) + 2*floor(n/3): seq(A131380(n), n=0..100); # Wesley Ivan Hurt, Aug 20 2014
MATHEMATICA
Table[Mod[-n, 3] + 2 Floor[n/3], {n, 0, 100}] (* Wesley Ivan Hurt, Aug 20 2014 *)
CoefficientList[Series[x*(2 - x + x^2)/((x - 1)^2 (1 + x + x^2)), {x, 0, 100}], x] (* Wesley Ivan Hurt, Aug 20 2014 *)
LinearRecurrence[{1, 0, 1, -1}, {0, 2, 1, 2}, 200] (* Vincenzo Librandi, Sep 27 2017 *)
PROG
(Magma) [(-n mod 3) + 2*Floor(n/3) : n in [0..100]]; // Wesley Ivan Hurt, Aug 20 2014
(Magma) I:=[0, 2, 1, 2]; [n le 4 select I[n] else Self(n-1)+Self(n-3)-Self(n-4): n in [1..100]]; // Vincenzo Librandi, Sep 27 2017
CROSSREFS
Sequence in context: A165053 A302982 A238577 * A100461 A302655 A316997
KEYWORD
nonn,easy
AUTHOR
Paul Curtz, Oct 01 2007
STATUS
approved