login
a(n) = a(a(n-1)) + a(n-a(n-2)) with a(1) = a(2) = a(5) = 1, a(3) = a(6) = 2, a(4) = 6.
1

%I #18 Jun 27 2018 10:37:13

%S 1,1,2,6,1,2,3,4,8,6,4,8,12,10,8,6,10,14,18,16,8,6,10,20,24,22,8,6,10,

%T 26,30,28,8,6,10,32,36,34,8,6,10,38,42,40,8,6,10,44,48,46,8,6,10,50,

%U 54,52,8,6,10,56,60,58,8,6,10,62,66,64,8,6,10,68,72,70,8,6,10,74,78,76,8,6,10

%N a(n) = a(a(n-1)) + a(n-a(n-2)) with a(1) = a(2) = a(5) = 1, a(3) = a(6) = 2, a(4) = 6.

%H Colin Barker, <a href="/A302551/b302551.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Rec#order_10">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,-1,1,0,1,-1,0,1,-1).

%F a(6*k-3) = 8, a(6*k-2) = 6, a(6*k-1) = 10, a(6*k) = 6*k - 4, a(6*k+1) = 6*k, a(6*k + 2) = 6*k - 2 for k > 2.

%F From _Colin Barker_, Jun 20 2018: (Start)

%F G.f.: x*(1 + x^2 + 5*x^3 - 5*x^4 + 2*x^5 + 4*x^6 - 4*x^7 + 4*x^8 - 6*x^9 + 4*x^10 + 6*x^11 - 3*x^12 - 3*x^14 + 3*x^15 + 3*x^16 - 6*x^17 + 6*x^19 - 6*x^20) / ((1 - x)^2*(1 + x)^2*(1 - x + x^2)^2*(1 + x + x^2)).

%F a(n) = a(n-1) - a(n-3) + a(n-4) + a(n-6) - a(n-7) + a(n-9) - a(n-10) for n>13.

%F (End)

%o (PARI) a=vector(99); a[1]=1;a[2]=1;a[3]=2;a[4]=6;a[5]=1;a[6]=2;for(n=7, #a, a[n] = a[a[n-1]]+a[n-a[n-2]]); a

%o (PARI) Vec(x*(1 + x^2 + 5*x^3 - 5*x^4 + 2*x^5 + 4*x^6 - 4*x^7 + 4*x^8 - 6*x^9 + 4*x^10 + 6*x^11 - 3*x^12 - 3*x^14 + 3*x^15 + 3*x^16 - 6*x^17 + 6*x^19 - 6*x^20) / ((1 - x)^2*(1 + x)^2*(1 - x + x^2)^2*(1 + x + x^2)) + O(x^80)) \\ _Colin Barker_, Jun 20 2018

%o (GAP) a:=[1,1,2,6,1,2];; for n in [7..100] do a[n]:=a[a[n-1]]+a[n-a[n-2]]; od; a; # _Muniru A Asiru_, Jun 26 2018

%Y Cf. A244477.

%K nonn,easy

%O 1,3

%A _Altug Alkan_, Jun 20 2018