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,0,0,0,0,2,0,0,0,0,0,-1).
FORMULA
a(6*k + 1) = 2, a(6*k - 4) = 6*k - 4, a(6*k + 3) = 3, a(6*k - 2) = 4, a(6*k - 1) = a(6*k) = 6*k - 2 for k >= 1. - Iain Fox, Dec 10 2017
From Colin Barker, Dec 11 2017: (Start)
G.f.: x*(1 + 2*x + x^2 + 4*x^3 + 4*x^4 + 4*x^5 + 4*x^7 + x^8 - 4*x^9 + 2*x^10 + 2*x^11 - x^12 - 2*x^14) / ((1 - x)^2*(1 + x)^2*(1 - x + x^2)^2*(1 + x + x^2)^2).
a(n) = 2*a(n-6) - a(n-12) for n>13.
(End)
MATHEMATICA
Fold[Append[#1, #1[[#2 - #1[[#2 - 1]] ]] + #1[[#2 - #1[[#2 - 2]] ]] ] &, {1, 2, 1, 4, 4}, Range[6, 84]] (* Michael De Vlieger, Dec 11 2017 *)
PROG
(PARI) q=vector(10^5); q[1]=1; q[2]=2; q[3]=1; q[4]=4; q[5]=4; for(n=6, #q, q[n] = q[n-q[n-1]]+q[n-q[n-2]]); q
(PARI) Vec(x*(1 + 2*x + x^2 + 4*x^3 + 4*x^4 + 4*x^5 + 4*x^7 + x^8 - 4*x^9 + 2*x^10 + 2*x^11 - x^12 - 2*x^14) / ((1 - x)^2*(1 + x)^2*(1 - x + x^2)^2*(1 + x + x^2)^2) + O(x^40)) \\ Colin Barker, Dec 11 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Altug Alkan, Dec 10 2017
STATUS
approved