login
A109535
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
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, 27, 41, 39, 51, 35, 51, 41, 63, 35, 53, 51, 65, 45, 65, 51, 77, 45, 67, 61, 81, 53, 77, 63, 95, 51, 77, 75, 93, 65, 93, 71, 107, 63, 93, 83, 111, 71, 103, 85, 127, 67, 101, 99, 121, 85
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).
MAPLE
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);
MATHEMATICA
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}]
CROSSREFS
Cf. A000069.
Sequence in context: A228543 A367928 A254764 * A361327 A180496 A082433
KEYWORD
nonn
AUTHOR
Roger L. Bagula, Jun 18 2005
STATUS
approved