login
A287477
a(0) = 0; a(1) = 1; a(2*n) = n - a(a(n)), a(2*n+1) = a(n-a(n)) + a(n-a(n+1)).
4
0, 1, 0, 1, 2, 1, 2, 1, 4, 1, 4, 3, 6, 3, 6, 3, 6, 3, 8, 5, 8, 3, 10, 5, 10, 3, 12, 5, 12, 7, 14, 7, 14, 7, 16, 7, 14, 7, 18, 9, 16, 9, 20, 11, 18, 9, 22, 11, 20, 9, 24, 13, 20, 9, 26, 13, 22, 9, 28, 13, 24, 11, 30, 13, 26, 11, 32, 15, 28, 13, 34, 15, 30, 17, 36, 19, 30, 15, 38, 19, 34, 17, 40, 17, 34, 17
OFFSET
0,5
COMMENTS
A variation on Hofstadter's G-sequence, Hofstadter's Q-sequence and Stern's diatomic sequence.
LINKS
MATHEMATICA
a[0] = 0; a[1] = 1; a[n_] := If[EvenQ[n], n/2 - a[a[n/2]], a[(n - 1)/2 - a[(n - 1)/2]] + a[(n - 1)/2 - a[(n + 1)/2]]]; Table[a[n], {n, 0, 85}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, May 25 2017
STATUS
approved