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,0,0,2,-2,0,0,0,-1,1).
FORMULA
The pattern is obvious!
a(n) = (n - 4*floor(n/5))^2. - Michael Somos, Jun 01 1999
G.f.: x*(1+3*x+5*x^2+7*x^3-15*x^4+x^5-x^6-3*x^7-5*x^8+9*x^9) / ((1-x)^3*(1+x+x^2+x^3+x^4)^2). - Colin Barker, Aug 05 2016
MATHEMATICA
Table[(n - 4*Floor[n/5])^2, {n, 60}] (* Arkadiusz Wesolowski, Sep 29 2011 *)
LinearRecurrence[{1, 0, 0, 0, 2, -2, 0, 0, 0, -1, 1}, {1, 4, 9, 16, 1, 4, 9, 16, 25, 4, 9}, 80] (* or *) Join[ Range[4]^2, Flatten[Partition[Range[20]^2, 5, 1]]] (* Harvey P. Dale, May 11 2022 *)
PROG
(Magma) [(n-4*Floor(n/5))^2: n in [1..60]]; // Vincenzo Librandi, Sep 30 2011
(PARI) Vec(x*(1+3*x+5*x^2+7*x^3-15*x^4+x^5-x^6-3*x^7-5*x^8+9*x^9)/((1-x)^3*(1+x+x^2+x^3+x^4)^2) + O(x^60)) \\ Colin Barker, Aug 05 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved