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