OFFSET
1,4
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,2,0,0,0,0,-1).
FORMULA
a(5k) = a(5k + 3) = 1, a(5k + 1) = 5k - 1, a(5k + 2) = 2, a(5k + 4) = 5k + 1 for k > 0.
From Colin Barker, Jun 28 2017: (Start)
G.f.: x*(1 + x)*(1 + x^2 + 2*x^3 - x^4 + 3*x^5 - 3*x^6 + 2*x^7 - 2*x^8 + x^9 + x^10 - 2*x^11 + 2*x^12) / ((1 - x)^2*(1 + x + x^2 + x^3 + x^4)^2).
a(n) = 2*a(n-5) - a(n-10) for n>12.
(End)
MATHEMATICA
LinearRecurrence[{0, 0, 0, 0, 2, 0, 0, 0, 0, -1}, {1, 1, 1, 3, 1, 4, 2, 1, 6, 1, 9, 2, 1, 11}, 120] (* Harvey P. Dale, Aug 20 2017 *)
PROG
(PARI) q=vector(10^5); q[1]=q[2]=q[3]=1; q[4]=3; for(n=5, #q, q[n] = n-q[n-q[n-1]]-q[n-q[n-2]]); q
(PARI) Vec(x*(1 + x)*(1 + x^2 + 2*x^3 - x^4 + 3*x^5 - 3*x^6 + 2*x^7 - 2*x^8 + x^9 + x^10 - 2*x^11 + 2*x^12) / ((1 - x)^2*(1 + x + x^2 + x^3 + x^4)^2) + O(x^100)) \\ Colin Barker, Jun 28 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Altug Alkan, Jun 28 2017
STATUS
approved