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

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A165413 a(n) = number of distinct lengths of runs in the binary representation of n. 5
1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 1, 2, 2, 2, 2, 2, 2, 3, 2, 1, 2, 2, 2, 3, 1, 3, 2, 3, 2, 2, 2, 1, 2, 2, 2, 3, 3, 2, 3, 2, 3, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 1, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 3, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,4

COMMENTS

Least k whose value is n: 1, 4, 35, 536, 16775, 1060976, ..., . - Robert G. Wilson v, Sep 30 2009

LINKS

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

FORMULA

a(n) = 1 for n in A140690. - Robert G. Wilson v, Sep 30 2009

EXAMPLE

92 in binary is 1011100. There is a run of one 1, followed by a run of one 0, then a run of three 1's, then finally a run of two 0's. The run lengths are therefore (1,1,3,2). The distinct values of these run lengths are (1,3,2). Since there are 3 distinct values, then a(92) = 3.

MATHEMATICA

f[n_] := Length@ Union@ Map[ Length, Split@ IntegerDigits[n, 2]]; Array[f, 105] (* Robert G. Wilson v, Sep 30 2009 *)

PROG

(Haskell)

import Data.List (group, nub)

a165413 = length . nub . map length . group . a030308_row

-- Reinhard Zumkeller, Mar 02 2013

(PARI)

binruns(n) = {

  if (n == 0, return([1, 0]));

  my(bag = List(), v=0);

  while(n != 0,

        v = valuation(n, 2); listput(bag, v); n >>= v; n++;

        v = valuation(n, 2); listput(bag, v); n >>= v; n--);

  return(Vec(bag));

};

a(n) = #Set(select(k->k, binruns(n)));

vector(105, i, a(i))  \\ Gheorghe Coserea, Sep 17 2015

CROSSREFS

Cf. A005811, A165414

Cf. A030308, A044813.

Cf. A140690

Sequence in context: A022921 A080763 A245920 * A172155 A080573 A186440

Adjacent sequences:  A165410 A165411 A165412 * A165414 A165415 A165416

KEYWORD

base,nonn

AUTHOR

Leroy Quet, Sep 17 2009

EXTENSIONS

More terms from Robert G. Wilson v, Sep 30 2009

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 September 19 11:06 EDT 2019. Contains 327192 sequences. (Running on oeis4.)