login
a(0) = 1, a(n) = n+a(floor(n/2)) if n mod 2 = 0, a(n) = n-a(floor((n-1)/2)) if n mod 2 = 1.
1

%I #5 Dec 04 2018 21:03:37

%S 1,0,2,3,6,3,9,4,14,3,13,8,21,4,18,11,30,3,21,16,33,8,30,15,45,4,30,

%T 23,46,11,41,20,62,3,37,32,57,16,54,23,73,8,50,35,74,15,61,32,93,4,54,

%U 47,82,23,77,32,102,11,69,48,101,20,82,43,126,3,69,64,105,32,102,39,129,16

%N a(0) = 1, a(n) = n+a(floor(n/2)) if n mod 2 = 0, a(n) = n-a(floor((n-1)/2)) if n mod 2 = 1.

%C A slightly different recurrence relation, a(0) = 1, a(n) = n+a(floor(n/2)) if n mod 2 = 0, a(n)=3n-a(floor((n-1)/2)) if n mod 2 = 1, leads to the odious numbers (odd number of 1's in binary expansion; A000069).

%H Ivan Neretin, <a href="/A109536/b109536.txt">Table of n, a(n) for n = 0..9999</a>

%p a:=proc(n) if n=0 then 1 elif n mod 2 = 0 then n+a(floor(n/2)) else n-a(floor((n-1)/2)) fi end: seq(a(n),n=0..90);

%t a[0] = 1; a[n_] := a[n] = If[Mod[n, 2] == 0, a[Floor[n/2]] + n, -a[Floor[(n - 1)/2]] + n] aa = Table[a[n], {n, 0, 100}]

%Y Cf. A000069.

%K nonn

%O 0,3

%A _Roger L. Bagula_, Jun 18 2005