OFFSET
1,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
a(n) = 3*n-3*floor(n/3)-(n^2 mod 3), with offset 0. - Gary Detlefs, Mar 19 2010
G.f.: x^2*(x+2)*(1+x) / ((1+x+x^2)*(x-1)^2). - R. J. Mathar, Oct 08 2011
From Wesley Ivan Hurt, Jun 13 2016: (Start)
a(n) = a(n-1) + a(n-3) - a(n-4) for n>4.
a(n) = (6*n-5+2*cos(2*n*Pi/3))/3.
a(3k) = 6k-1, a(3k-1) = 6k-4, a(3k-2) = 6k-6. (End)
E.g.f.: (3 + (6*x - 5)*exp(x) + 2*cos(sqrt(3)*x/2)*(cosh(x/2) - sinh(x/2)))/3. - Ilya Gutkovskiy, Jun 14 2016
Sum_{n>=2} (-1)^n/a(n) = log(2)/3 + log(2+sqrt(3))/(2*sqrt(3)) - (3-sqrt(3))*Pi/18. - Amiram Eldar, Dec 14 2021
MAPLE
seq(3*n-3*floor(n/3)-(n^2 mod 3), n=0..54); # Gary Detlefs, Mar 19 2010
MATHEMATICA
Select[Range[0, 110], MemberQ[{0, 2, 5}, Mod[#, 6]]&] (* or *) LinearRecurrence[{1, 0, 1, -1}, {0, 2, 5, 6}, 60] (* Harvey P. Dale, Aug 31 2015 *)
PROG
(Magma) [n : n in [0..150] | n mod 6 in [0, 2, 5]]; // Wesley Ivan Hurt, Jun 13 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved