

A043276


a(n) = maximal run length in base2 representation of n.


32



1, 1, 2, 2, 1, 2, 3, 3, 2, 1, 2, 2, 2, 3, 4, 4, 3, 2, 2, 2, 1, 2, 3, 3, 2, 2, 2, 3, 3, 4, 5, 5, 4, 3, 3, 2, 2, 2, 3, 3, 2, 1, 2, 2, 2, 3, 4, 4, 3, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 5, 6, 6, 5, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 3, 4, 4, 3, 2, 2, 2, 1, 2, 3, 3, 2, 2, 2, 3, 3, 4, 5, 5, 4, 3, 3, 2, 2, 2, 3, 3, 2
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,3


COMMENTS

First occurrence of k is when n=2^k1 and there is no last occurrence.  Robert G. Wilson v, Dec 14 2008
Sequences A000975, A037969, A037970, A037971 list numbers for which a(n)=1, a(n)=2, a(n)=3, a(n)=4.  M. F. Hasler, Jul 23 2013
a(n) = max(A101211(n,k): k = 1..A005811(n)).  Reinhard Zumkeller, Dec 16 2013


LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..10000


MATHEMATICA

f[n_] := Max @@ Length /@ Split@IntegerDigits[n, 2]; Array[f, 105] (* Robert G. Wilson v, Dec 14 2008 *)


PROG

(PARI) A043276(n, b=2)={my(m, c=1); while(n>0, n%b==(n\=b)%b && c++ && next; m=max(m, c); c=1); m} \\  M. F. Hasler, Jul 23 2013
(PARI) a(n)=my(r, t); while(n, t=valuation(n, 2); if(t>r, r=t); n>>=t; t=valuation(n+1, 2); if(t>r, r=t); n>>=t); r \\ Charles R Greathouse IV, Nov 02 2016
(Haskell)
a043276 = maximum . a101211_row  Reinhard Zumkeller, Dec 16 2013


CROSSREFS

Cf. A043277A043290 for base3 to base16 analogs.
Sequence in context: A106580 A165915 A269783 * A319416 A284559 A284583
Adjacent sequences: A043273 A043274 A043275 * A043277 A043278 A043279


KEYWORD

nonn,base,look


AUTHOR

Clark Kimberling


EXTENSIONS

More terms from Robert G. Wilson v, Dec 14 2008


STATUS

approved



