login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A227188 Square array A(n,k) read by antidiagonals: the one-based bit-index where the (k+1)-st run in the binary expansion of n ends, as read from the least significant end. 6
0, 0, 1, 0, 0, 1, 0, 0, 2, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 2 (list; table; graph; refs; listen; history; text; internal format)
OFFSET
0,9
COMMENTS
A(n,k) is set to zero if there are fewer runs in n than k+1.
Equally, when A005811(n) > 1, A(n,k) gives the zero-based bit-index where the (k+2)-th run in the binary expansion of n starts, counted from the least significant end.
Each row gives the partial sums of the terms on the corresponding row in A227186, up to the first zero.
LINKS
FORMULA
A(n,0) = A136480(n), n>0.
EXAMPLE
The top-left corner of the array:
row # row starts as
0 0, 0, 0, 0, 0, ...
1 1, 0, 0, 0, 0, ...
2 1, 2, 0, 0, 0, ...
3 2, 0, 0, 0, 0, ...
4 2, 3, 0, 0, 0, ...
5 1, 2, 3, 0, 0, ...
6 1, 3, 0, 0, 0, ...
7 3, 0, 0, 0, 0, ...
8 3, 4, 0, 0, 0, ...
9 1, 3, 4, 0, 0, ...
10 1, 2, 3, 4, 0, ...
11 2, 3, 4, 0, 0, ...
12 2, 4, 0, 0, 0, ...
13 1, 2, 4, 0, 0, ...
14 1, 4, 0, 0, 0, ...
15 4, 0, 0, 0, 0, ...
16 4, 5, 0, 0, 0, ...
etc.
For example, for n = 8, whose binary expansion is "1000", we get the run lengths 3 and 1 (scanning from the right), partial sums of which are 3 and 4, thus row 8 begins as A(8,0)=3, A(8,1)=4, A(8,2)=0, ...
MAPLE
A227188 := proc(n, k)
local bdgs, ru, i, b, a;
bdgs := convert(n, base, 2) ;
if nops(bdgs) = 0 then
return 0 ;
end if;
ru := 0 ;
i := 1 ;
b := op(i, bdgs) ;
for i from 2 to nops(bdgs) do
if op(i, bdgs) <> op(i-1, bdgs) then
if ru = k then
return i-1;
end if;
ru := ru+1 ;
end if;
end do:
if ru =k then
nops(bdgs) ;
else
0 ;
end if;
end proc: # R. J. Mathar, Jul 23 2013
MATHEMATICA
Table[PadRight[Rest@FoldList[Plus, 0, Length/@Split[Reverse[IntegerDigits[j, 2]]]], i+1-j][[i+1-j]], {i, 0, 16}, {j, 0, i}]; Wouter Meeussen, Aug 31 2013
PROG
(Scheme)
(define (A227188 n) (A227188bi (A002262 n) (A025581 n)))
(define (A227188bi n k) (cond ((< (A005811 n) (+ 1 k)) 0) ((zero? k) (A136480 n)) (else (+ (A136480 n) (A227188bi (A163575 n) (- k 1))))))
CROSSREFS
Cf. A227192 (row sums). Number of nonzero terms on each row: A005811.
Cf. also A227186, A227189, A163575.
Sequence in context: A236109 A279279 A035447 * A354107 A037863 A163536
KEYWORD
nonn,tabl,base
AUTHOR
Antti Karttunen, Jul 06 2013
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 23:40 EDT 2024. Contains 371798 sequences. (Running on oeis4.)