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

%I #2 Mar 30 2012 17:34:19

%S 1,1,3,5,7,7,11,9,15,11,17,15,23,15,23,21,31,19,29,27,37,25,37,31,47,

%T 27,41,39,51,35,51,41,63,35,53,51,65,45,65,51,77,45,67,61,81,53,77,63,

%U 95,51,77,75,93,65,93,71,107,63,93,83,111,71,103,85,127,67,101,99,121,85

%N a(0) = 1, a(n) = n+a(floor(n/2)) if n mod 2 = 0, a(n) = 2n-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).

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

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

%Y Cf. A000069.

%K nonn

%O 0,3

%A _Roger L. Bagula_, Jun 18 2005