

A089265


a(1) = 0; thereafter a(2*n) = a(n) + 1, a(2*n+1) = 2*n.


3



0, 1, 2, 2, 4, 3, 6, 3, 8, 5, 10, 4, 12, 7, 14, 4, 16, 9, 18, 6, 20, 11, 22, 5, 24, 13, 26, 8, 28, 15, 30, 5, 32, 17, 34, 10, 36, 19, 38, 7, 40, 21, 42, 12, 44, 23, 46, 6, 48, 25, 50, 14, 52, 27, 54, 9, 56, 29, 58, 16, 60, 31, 62, 6, 64, 33, 66, 18, 68, 35, 70, 11, 72
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,3


COMMENTS

In the binary representation of n, swallow all zeros from the right, then add the number of swallowed zeros, and subtract 1.  Ralf Stephan, Aug 22 2013


LINKS

T. D. Noe, Table of n, a(n) for n=1..1000
Index entries for sequences related to binary expansion of n


FORMULA

a(1) = 0; thereafter a(2*n) = a(n) + 1, a(2*n+1) = 2*n.
a(n) = A007814(n) + 2*A025480(n1) = A007814(n) + A000265(n)  1.
G.f.: sum(k>=0, (t^2+2t^3t^4)/(1t^2)^2, t=(x^2)^k).
a((2*n1)*2^p) = p + 2*(n1), p >= 0.  Johannes W. Meijer, Jan 23 2013


MAPLE

nmax:=73: for p from 0 to ceil(simplify(log[2](nmax))) do for n from 1 to ceil(nmax/(p+2)) do a((2*n1)*2^p) := p + 2*(n1) od: od: seq(a(n), n=1..nmax); # Johannes W. Meijer, Jan 23 2013


PROG

(PARI) a(n) = valuation(n, 2) + n/2^valuation(n, 2)  1


CROSSREFS

First differences of A005766.
Cf. A003602, A220466.
Sequence in context: A058266 A138664 A140357 * A113885 A113886 A220096
Adjacent sequences: A089262 A089263 A089264 * A089266 A089267 A089268


KEYWORD

nonn,easy


AUTHOR

Ralf Stephan, Oct 30 2003


STATUS

approved



