login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(1) = a(2) = 1; a(n) = n - a(a(n-1)) - a(n-a(n-1)) for n > 2.
5

%I #36 Sep 08 2022 08:46:19

%S 1,1,1,2,3,4,4,4,4,4,5,5,6,6,7,8,9,10,11,11,12,13,13,13,14,15,15,15,

%T 16,16,16,16,16,16,16,17,17,17,17,18,18,19,19,19,19,20,21,21,22,22,22,

%U 23,24,25,25,26,26,27,28,29,29,30,31,32,33,34,35,36,36,37,38,39,40,40,41,42,42,42,43,44,45,46,46

%N a(1) = a(2) = 1; a(n) = n - a(a(n-1)) - a(n-a(n-1)) for n > 2.

%H Michael De Vlieger, <a href="/A287422/b287422.txt">Table of n, a(n) for n = 1..10000</a>

%H Altug Alkan, <a href="/A287422/a287422.png">Plot of a(n)-n/2 for n<=2^20</a>

%H Altug Alkan, <a href="/A287422/a287422_1.png">Plot of (a(n-a(n-1))/n, a(a(n-1))/n) for n <= 250000</a>

%H Rémy Sigrist, <a href="/A287422/a287422_2.png">Colored scatterplot of (a(n-a(n-1))/n, a(a(n-1))/n) for n <= 100000000</a> (where the hue is function of n)

%t Nest[Function[{a, n}, Append[a, n - a[[a[[-1]] ]] - a[[-a[[-1]] ]] ] ] @@ {#, Length@ # + 1} &, {1, 1}, 80] (* _Michael De Vlieger_, Aug 07 2018 *)

%o (PARI) q=vector(10000); q[1]=q[2]=1; for(n=3, #q, q[n]=n-q[q[n-1]]-q[n-q[n-1]]); q

%o (Magma) I:=[1,1,1,2]; [n le 4 select I[n] else n - Self(Self(n-1)) - Self(n-Self(n-1)): n in [1..100]]; // _Vincenzo Librandi_, Aug 08 2018

%Y Cf. A003160, A004001, A005206, A088462, A189663.

%K nonn

%O 1,4

%A _Altug Alkan_, Jun 24 2017