OFFSET
0,5
COMMENTS
A variation on Hofstadter's G-sequence and Stern's diatomic sequence.
LINKS
Eric Weisstein's World of Mathematics, Stern's Diatomic Series
Eric Weisstein's World of Mathematics, Hofstadter G-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