OFFSET
1,2
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (0,1,0,1,0,-1).
FORMULA
a(2*k) = 2*(k-2) for k >= 5, a(4*j+1) = 3 for j >= 2, a(4*m-1) = 1 for m >= 1.
From Colin Barker, Dec 12 2017: (Start)
G.f.: x*(1 + 3*x + 2*x^4 - 4*x^5 - 3*x^6 + x^7 - x^8 + 4*x^9 + x^10 + x^11 - x^13) / ((1 - x)^2*(1 + x)^2*(1 + x^2)).
a(n) = a(n-2) + a(n-4) - a(n-6) for n>12.
(End)
MATHEMATICA
Fold[Append[#1, #2 - #1[[#2 - #1[[#2 - 1]] ]] - #1[[#2 - #1[[#2 - 4]] ]] ] &, {1, 3, 1, 3, 4}, Range[6, 90]] (* Michael De Vlieger, Dec 11 2017 *)
PROG
(PARI) q=vector(10^5); q[1]=1; q[2]=3; q[3]=1; q[4]=3; q[5]=4; for(n=6, #q, q[n] = n-q[n-q[n-1]]-q[n-q[n-4]]); q
(PARI) Vec(x*(1 + 3*x + 2*x^4 - 4*x^5 - 3*x^6 + x^7 - x^8 + 4*x^9 + x^10 + x^11 - x^13) / ((1 - x)^2*(1 + x)^2*(1 + x^2)) + O(x^100)) \\ Colin Barker, Dec 12 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Altug Alkan, Dec 11 2017
STATUS
approved