login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Thanks to everyone who made a donation during our annual appeal!
To see the list of donors, or make a donation, see the OEIS Foundation home page.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A290255 Number of 0's following directly the first 1 in the binary representation of n. 2
0, 1, 0, 2, 1, 0, 0, 3, 2, 1, 1, 0, 0, 0, 0, 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 5, 4, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,4

LINKS

Robert Israel, Table of n, a(n) for n = 1..10000

FORMULA

a(2^k)= k (k>=0); otherwise, a(n) = a(floor(n/2)).

G.f. q(x) + Sum_{j>=1} q(x^(2^j))*(x^(2^j)-x^(2^(j-1)))/(x-1) where q(z) = Sum_{j>=1} j*x^(2^j). - Robert Israel, Sep 03 2017

EXAMPLE

a(19) = 2 because 19_2 = 10'0'11; a(21) = 1 because 21_2 = 10'101_2 (the counted 0's are marked).

MAPLE

a := proc (n) if type(log[2](n), integer) = true then log[2](n) else a(floor((1/2)*n)) end if end proc: seq(a(n), n = 1 .. 200);

# Alternate:

f := proc(n) option remember; local v;

v:= padic:-ordp(n, 2);

  if n = 2^v then v else procname((n-2^v)/2^(v+1)) fi

end proc:

map(f, [$1..1000]); # Robert Israel, Sep 03 2017

MATHEMATICA

sfo[n_]:=Module[{sidn2=Split[IntegerDigits[n, 2]]}, If[Length[ sidn2[[1]]]> 1, 0, Length[ sidn2[[2]]]]]; Join[{0}, Array[sfo, 110, 2]] (* Harvey P. Dale, Mar 04 2018 *)

CROSSREFS

Sequence in context: A037872 A037854 A091229 * A283982 A173402 A055334

Adjacent sequences:  A290252 A290253 A290254 * A290256 A290257 A290258

KEYWORD

nonn

AUTHOR

Emeric Deutsch, Sep 03 2017

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 17 09:54 EST 2020. Contains 330949 sequences. (Running on oeis4.)