OFFSET
1,1
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..2000 (first 945 terms from Alec Jones)
Index entries for linear recurrences with constant coefficients, signature (0,0,2,0,0,-1).
FORMULA
For n > 2: a(n) = 1 if 3 divides n; a(n) = (1/3)*(n-1) if n == 1 (mod 3); a(n) = a(n-1) + 2 if n == 2 (mod 3).
For n > 2, a(n) = (4*n + 12 + (6-4*n)*cos(2*n*Pi/3) - 5*sqrt(3)*sin(2*n*Pi/3) + 5*sqrt(3)*sin(4*n*Pi/3))/18. - Wesley Ivan Hurt, Sep 25 2017
From Colin Barker, Sep 26 2017: (Start)
G.f.: x*(2 + 3*x + x^2 - 3*x^3 - 3*x^4 - x^5 + 2*x^6 + x^7) / ((1 - x)^2*(1 + x + x^2)^2).
a(n) = 2*a(n-3) - a(n-6) for n>8. (End)
MATHEMATICA
Join[{2, 3}, LinearRecurrence[{0, 0, 2, 0, 0, -1}, {1, 1, 3, 1, 2, 4}, 200]] (* Vincenzo Librandi, Sep 27 2017 *)
PROG
(PARI) Vec(x*(2 + 3*x + x^2 - 3*x^3 - 3*x^4 - x^5 + 2*x^6 + x^7) / ((1 - x)^2*(1 + x + x^2)^2) + O(x^100)) \\ Colin Barker, Sep 26 2017
(Magma) I:=[2, 3, 1, 1, 3, 1, 2, 4]; [n le 8 select I[n] else 2*Self(n-3)-Self(n-6): n in [1..100]]; // Vincenzo Librandi, Sep 27 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Alec Jones, Apr 12 2016
STATUS
approved