OFFSET
1,2
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..10000
R. E. Kutz, Two unusual sequences, Two-Year College Mathematics Journal, 12 (1981), 316-319.
Index entries for linear recurrences with constant coefficients, signature (1,0,2,-2,0,-1,1).
FORMULA
a(n) = (n-2*floor(n/3))^2. - Arkadiusz Wesolowski, Sep 28 2011
From Colin Barker, Aug 05 2016: (Start)
a(n) = a(n-1)+2*a(n-3)-2*a(n-4)-a(n-6)+a(n-7) for n>7.
G.f.: x*(1+3*x-3*x^2+x^3-x^4+x^5) / ((1-x)^3*(1+x+x^2)^2).
(End)
MATHEMATICA
Table[(n - 2*Floor[n/3])^2, {n, 60}] (* Arkadiusz Wesolowski, Sep 29 2011 *)
PROG
(Magma) [(n-2*Floor(n/3))^2: n in [1..60]]; // Vincenzo Librandi, Sep 30 2011
(PARI) a(n)=(n-n\3*2)^2 \\ Charles R Greathouse IV, Aug 05 2016
(PARI) Vec(x*(1+3*x-3*x^2+x^3-x^4+x^5)/((1-x)^3*(1+x+x^2)^2) + O(x^60)) \\ Colin Barker, Aug 05 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved