login
A109536
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
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, 23, 46, 11, 41, 20, 62, 3, 37, 32, 57, 16, 54, 23, 73, 8, 50, 35, 74, 15, 61, 32, 93, 4, 54, 47, 82, 23, 77, 32, 102, 11, 69, 48, 101, 20, 82, 43, 126, 3, 69, 64, 105, 32, 102, 39, 129, 16
OFFSET
0,3
COMMENTS
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).
LINKS
MAPLE
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);
MATHEMATICA
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}]
CROSSREFS
Cf. A000069.
Sequence in context: A129915 A019773 A350728 * A267352 A101401 A106834
KEYWORD
nonn
AUTHOR
Roger L. Bagula, Jun 18 2005
STATUS
approved