

A108730


Triangle read by rows: row n gives list of number of zeros following each 1 in binary representation of n.


4



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



OFFSET

1,5


COMMENTS

This is probably the simplest method for putting the nonnegative integers into onetoone correspondence with the finite sequences of nonnegative integers and is the standard ordering for such sequences in this database.
This sequence contains every finite sequence of nonnegative integers.
This can be regarded as a table in two ways: with each composition as a row, or with the compositions of each integer as a row. The first way has A000120 as row lengths and A080791 as row sums; the second has A001792 as row lengths and A001787 as row sums.  Franklin T. AdamsWatters, Nov 06 2006
Concatenate the basetwo positive integers (A030190 less the initial zero). Left to right and disallowing leading zeros, reorganize the digits into the smallest possible numbers. These will be the basetwo powersoftwo of A108730.  Hans Havermann, Nov 14 2009
T(2^(n1),0) = n1 and T(m,k) < n1 for all m < 2^n, k <= A000120(m). When the triangle is seen as a flattened list, each n occurs first at position n*2^(n1)+1, cf. A005183.  Reinhard Zumkeller, Feb 26 2012


LINKS

Franklin T. AdamsWatters, Table of n, a(n) for n = 1..5120 (through 10 bit numbers)


EXAMPLE

Triangle begins:
0
1
0,0
2
1,0
0,1
0,0,0
3
For example, 25 base 2 = 11001; following the 1's are 0, 2 and 0 zeros, so row 25 is 0, 2, 0.


MATHEMATICA

row[n_] := (id = IntegerDigits[n, 2]; sp = Split[id]; f[run_List] := If[First[run] == 0, run, Sequence @@ Table[{}, {Length[run]  1}]]; len = Length /@ f /@ sp; If[Last[id] == 0, len, Append[len, 0]]); Flatten[ Table[row[n], {n, 1, 41}]] (* JeanFrançois Alcover, Jul 13 2012 *)


PROG

(Haskell)
import Data.List (unfoldr, group)
a108730 n k = a108730_tabf !! (n1) !! (k1)
a108730_row = f . group . reverse . unfoldr
(\x > if x == 0 then Nothing else Just $ swap $ divMod x 2) where
f [] = []
f [os] = replicate (length os) 0
f (os:zs:dss) = replicate (length os  1) 0 ++ [length zs] ++ f dss
a108730_tabf = map a108730_row [1..]
a108730_list = concat a108730_tabf
 Reinhard Zumkeller, Feb 26 2012
(PARI) row(n)=my(v=vector(hammingweight(n)), t=n); for(i=0, #v1, v[#vi] = valuation(t, 2); t>>=v[#vi]+1); v \\ Charles R Greathouse IV, Sep 14 2015


CROSSREFS

Cf. A066099, A007088, A000120, A080791, A001792, A001787, A124735.
Sequence in context: A066301 A046660 A183094 * A056973 A107782 A086017
Adjacent sequences: A108727 A108728 A108729 * A108731 A108732 A108733


KEYWORD

easy,nice,nonn,tabf


AUTHOR

Franklin T. AdamsWatters, Jun 22 2005


EXTENSIONS

Edited by Franklin T. AdamsWatters, Nov 06 2006


STATUS

approved



