login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A144789 Consider the runs of 0's in the binary representation of n, each of these runs being on the edge of the binary representation n and/or being bounded by 1's. a(n) = the length of the shortest such run (with positive length) of 0's in binary n. a(n) = 0 if there are no runs of 0's in binary n. 4
0, 1, 0, 2, 1, 1, 0, 3, 2, 1, 1, 2, 1, 1, 0, 4, 3, 1, 2, 1, 1, 1, 1, 3, 2, 1, 1, 2, 1, 1, 0, 5, 4, 1, 3, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 4, 3, 1, 2, 1, 1, 1, 1, 3, 2, 1, 1, 2, 1, 1, 0, 6, 5, 1, 4, 2, 1, 1, 3, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 4, 1, 3, 2, 1, 1, 2, 1, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,4

LINKS

Table of n, a(n) for n=1..105.

EXAMPLE

20 in binary is 10100. The runs of 0s are as follows: 1(0)1(00). The shortest of these runs contains exactly one 0's So a(20) = 1.

MAPLE

A007814 := proc(n) local nshf, a ; a := 0 ; nshf := n ; while nshf mod 2 = 0 do nshf := nshf/2 ; a := a+1 ; od: a ; end: A144789 := proc(n) option remember ; local lp2, lp2sh, bind ; bind := convert(n, base, 2) ; if add(i, i=bind) = nops(bind) then RETURN(0) ; fi; lp2 := A007814(n) ; if lp2 = 0 then A144789(floor(n/2)) ; else lp2sh := A144789(n/2^lp2) ; if lp2sh = 0 then lp2 ; else min(lp2, lp2sh) ; fi; fi; end: for n from 1 to 140 do printf("%d, ", A144789(n)) ; od: # R. J. Mathar, Sep 29 2008

MATHEMATICA

Table[Min[Length/@Select[Split[IntegerDigits[n, 2]], MemberQ[#, 0]&]], {n, 120}]/.\[Infinity]->0 (* Harvey P. Dale, Jul 24 2016 *)

CROSSREFS

Cf. A087117, A144790.

Sequence in context: A156578 A171846 A097230 * A285097 A279209 A087117

Adjacent sequences:  A144786 A144787 A144788 * A144790 A144791 A144792

KEYWORD

base,nonn

AUTHOR

Leroy Quet, Sep 21 2008

EXTENSIONS

Extended by R. J. Mathar, Sep 29 2008

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 August 18 21:59 EDT 2019. Contains 326109 sequences. (Running on oeis4.)