%I #6 Jun 02 2017 00:29:39
%S 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,
%T 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,
%U 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
%N a(0) = 0, a(1) = 1; a(2*n) = n - a(a(n)), a(2*n+1) = a(a(n)) + a(a(n+1)).
%C A variation on Hofstadter's G-sequence and Stern's diatomic sequence.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/SternsDiatomicSeries.html">Stern's Diatomic Series</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/HofstadterG-Sequence.html">Hofstadter G-Sequence</a>
%H <a href="/index/St#Stern">Index entries for sequences related to Stern's sequences</a>
%H <a href="/index/Ho#Hofstadter">Index entries for Hofstadter-type sequences</a>
%F a(2*n) + a(2*n+1) + a(2*n+2) = 2*n + 1 (from definition).
%t 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}]
%Y Cf. A002487, A005206, A046698, A287475, A287476, A287477.
%K nonn
%O 0,5
%A _Ilya Gutkovskiy_, May 27 2017