login
A296337
a(1) = a(3) = 1, a(2) = 2, a(4) = a(5) = 4; a(n) = a(n-a(n-1)) + a(n-a(n-2)) for n > 5.
1
1, 2, 1, 4, 4, 4, 2, 8, 3, 4, 10, 10, 2, 14, 3, 4, 16, 16, 2, 20, 3, 4, 22, 22, 2, 26, 3, 4, 28, 28, 2, 32, 3, 4, 34, 34, 2, 38, 3, 4, 40, 40, 2, 44, 3, 4, 46, 46, 2, 50, 3, 4, 52, 52, 2, 56, 3, 4, 58, 58, 2, 62, 3, 4, 64, 64, 2, 68, 3, 4, 70, 70, 2, 74, 3, 4, 76, 76, 2, 80, 3, 4, 82, 82
OFFSET
1,2
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
Cf. A244477.
Sequence in context: A111975 A117250 A345674 * A308432 A136692 A368673
KEYWORD
nonn,easy
AUTHOR
Altug Alkan, Dec 10 2017
STATUS
approved