%I #14 Mar 27 2016 22:45:26
%S 0,3,-9,7,-9,11,27,15,-21,19,99,23,-33,27,63,31,-45,35,-117,39,-57,43,
%T 99,47,-69,51,-873,55,-81,59,135,63,-93,67,-225,71,-105,75,171,79,
%U -117,83,423,87,-129,91,207,95,-141,99,-333,103,-153,107,243,111,-165
%N a(0) = 0; a(odd n) = 2n+1; a(even n) = a(n/2 - a(n-1)).
%H Daniel Suteu, <a href="/A267363/b267363.txt">Table of n, a(n) for n = 0..20000</a>
%F a(0) = 0; a(odd n) = 2n+1; a(even n) = a(n/2 - a(n-1)).
%t a[0] = 0; a[n_] := a[n] = If[OddQ@ n, 2 n + 1, a[n/2 - a[n - 1]]]; Table[a@ n, {n, 56}] (* _Michael De Vlieger_, Jan 13 2016 *)
%o (Sidef)
%o func a({.is_zero}) { 0 }
%o func a(n {.is_odd}) { 2*n + 1 }
%o func a(n) is cached { a(n/2 - a(n-1)) }
%o 0.to(10).each { |i| say a(i) }
%o (PARI) a(n) = if (n==0, 0, if (n % 2, 2*n+1, a(n/2 - a(n-1)))); \\ _Michel Marcus_, Jan 13 2016
%K sign,easy
%O 0,2
%A _Daniel Suteu_, Jan 13 2016