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”).
%I #15 Mar 27 2016 10:30:27
%S 1,0,2,1,3,2,3,2,2,1,6,5,7,6,3,8,8,1,8,2,11,10,12,11,3,10,4,23,5,17,
%T 13,18,14,19,15,20,16,21,17,9,31,10,16,6,30,15,11,23,20,13,19,17,13,3,
%U 29,26,30,12,35,24,36,25,37,26,8,46,20,18,36,8,5,42,30,16,31,34,42,5,7,66,14,48,34,49,35,26,30,14,7,10,48,9,52,41,53,42,19,63,35,14
%N a(1) = 1; a(n) = min{(n-1-a(n-1));(n-1-i)}, where i (0<=i<=n-2) is the largest number such that a(n-1)=a(i) or i=0 if no such a(i) exists.
%C Sum_{i=1..n} a(n) ~ n*(n+1)/5.
%e a(1) = 1;
%e a(2) = min{(1-1);(1-0)} = 0;
%e a(3) = min{(2-0);(2-0)} = 2;
%e a(4) = min{(3-2);(3-0)} = 1;
%e a(5) = min{(4-1);(4-1)} = 3;
%e a(6) = min{(5-3);(5-0)} = 2;
%e a(7) = min{(6-2);(6-3)} = 3;
%e a(8) = min{(7-3);(7-5)} = 2;
%e a(9) = min{(8-2);(8-6)} = 2;
%e a(10) = min{(9-2);(9-8)} = 1;
%e and so on.
%t a = {1}; Do[AppendTo[a, Min[n - 1 - a[[n - 1]], n - 1 - (If[MissingQ@#, 0, #] &@ SelectFirst[Range[n - 2, 1, -1], a[[n - 1]] == a[[#]] &])]], {n, 2, 120}]; a (* _Michael De Vlieger_, Mar 27 2016, Version 10.2 *)
%Y Cf. A181391, A267794, A268584.
%K nonn
%O 1,3
%A _Ctibor O. Zizka_, Mar 22 2016