%I #16 Dec 19 2017 09:23:05
%S 1,3,1,3,4,2,1,3,3,6,1,8,3,10,1,12,3,14,1,16,3,18,1,20,3,22,1,24,3,26,
%T 1,28,3,30,1,32,3,34,1,36,3,38,1,40,3,42,1,44,3,46,1,48,3,50,1,52,3,
%U 54,1,56,3,58,1,60,3,62,1,64,3,66,1,68,3,70,1,72,3,74,1,76,3,78,1,80,3,82,1,84,3,86
%N a(1) = a(3) = 1, a(2) = a(4) = 3, a(5) = 4; a(n) = n - a(n-a(n-1)) - a(n-a(n-4)) for n > 5.
%H Colin Barker, <a href="/A296388/b296388.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,1,0,1,0,-1).
%F 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.
%F From _Colin Barker_, Dec 12 2017: (Start)
%F 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)).
%F a(n) = a(n-2) + a(n-4) - a(n-6) for n>12.
%F (End)
%t 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 *)
%o (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
%o (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
%Y Cf. A063882, A289205.
%K nonn,easy
%O 1,2
%A _Altug Alkan_, Dec 11 2017