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”).

A270755
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.
0
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, 13, 18, 14, 19, 15, 20, 16, 21, 17, 9, 31, 10, 16, 6, 30, 15, 11, 23, 20, 13, 19, 17, 13, 3, 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
OFFSET
1,3
COMMENTS
Sum_{i=1..n} a(n) ~ n*(n+1)/5.
EXAMPLE
a(1) = 1;
a(2) = min{(1-1);(1-0)} = 0;
a(3) = min{(2-0);(2-0)} = 2;
a(4) = min{(3-2);(3-0)} = 1;
a(5) = min{(4-1);(4-1)} = 3;
a(6) = min{(5-3);(5-0)} = 2;
a(7) = min{(6-2);(6-3)} = 3;
a(8) = min{(7-3);(7-5)} = 2;
a(9) = min{(8-2);(8-6)} = 2;
a(10) = min{(9-2);(9-8)} = 1;
and so on.
MATHEMATICA
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 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Ctibor O. Zizka, Mar 22 2016
STATUS
approved