|
|
A090996
|
|
Number of leading 1's in binary expansion of n.
|
|
15
|
|
|
0, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 1, 2, 2, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
COMMENTS
|
a(n) is also the least part in the integer partition having viabin number n. The viabin number of an integer partition is defined in the following way. Consider the southeast border of the Ferrers board of the integer partition and consider the binary number obtained by replacing each east step with 1 and each north step, except the last one, with 0. The corresponding decimal form is, by definition, the viabin number of the given integer partition. "Viabin" is coined from "via binary". For example, consider the integer partition [2,2,2,1]. The southeast border of its Ferrers board yields 10100, leading to the viabin number 20. - Emeric Deutsch, Jul 24 2017
|
|
LINKS
|
|
|
FORMULA
|
a(2^k-1)=k; for any other n, a(n) = a(floor(n/2)).
a(n) = f(n, 0) with f(n, x) = if n < 2 then n + x else f([n/2], (x+1)*(n mod 2)). - Reinhard Zumkeller, Feb 02 2007
Conjecture: a(n) = w(n+1)*(w(n+1)-w(n)+1) - w(2^(w(n+1)+1)-n-1) for n>0, where w(n) = floor(log_2(n)), that is, A000523(n). - Velin Yanev, Dec 21 2016
|
|
EXAMPLE
|
In binary : 14=1110 and there are 3 leading 1's, so a(14)=3.
Written as an irregular triangle with row lengths A011782 the sequence begins:
0;
1;
1,2;
1,1,2,3;
1,1,1,1,2,2,3,4;
1,1,1,1,1,1,1,1,2,2,2,2,3,3,4,5;
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,4,4,5,6;
(End)
|
|
MAPLE
|
a := proc(n) if type(log[2](n+1), integer) then log[2](n+1) else a(floor((1/2)*n)) end if end proc: seq(a(n), n = 0 .. 200); # Emeric Deutsch, Jul 24 2017
# second Maple program:
b:= proc(n, t) `if`(n=0, t,
b(iquo(n, 2, 'm'), m*(t+1)))
end:
a:= n-> b(n, 0):
|
|
MATHEMATICA
|
|
|
PROG
|
(PARI) a(n) = if(n==0, 0); b=binary(n+1); if(hammingweight(b) == 1, #b-1, a(n\2)) \\ David A. Corneth, Jul 24 2017
(PARI) a(n) = if(n==0, 0); my(b = binary(n), r = #b); for(i=2, #b, if(!b[i], return(i-1))); r \\ David A. Corneth, Jul 24 2017
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
Sequence had accidentally been shifted left by one step, which was corrected and term a(0)=0 added by Antti Karttunen, Jan 01 2007
|
|
STATUS
|
approved
|
|
|
|