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!)
A089309 Write n in binary; a(n) = length of the rightmost run of 1's. 15
0, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 1, 3, 4, 1, 1, 1, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 1, 4, 5, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 1, 3, 4, 2, 1, 1, 2, 1, 1, 2, 3, 3, 1, 1, 2, 4, 1, 5, 6, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 1, 3, 4, 1, 1, 1, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 1, 4, 5, 2, 1, 1, 2, 1, 1, 2, 3, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
Equivalent to: remove trailing zeros, add one, count trailing zeros. - Ralf Stephan, Aug 31 2013
a(n) is also the difference between the two largest distinct parts in the integer partition having viabin number n (we assume that 0 is a part). 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. Note that a(20) = 1 = the difference between the two largest distinct parts of the partition [2,2,2,1]. - Emeric Deutsch, Aug 17 2017
LINKS
Francis Laclé, 2-adic parity explorations of the 3n+ 1 problem, hal-03201180v2 [cs.DM], 2021.
FORMULA
a(2*n) = a(n), a(2*n+1) = A007814(2*n+2) = A001511(n+1). - Ralf Stephan, Jan 31 2004
a(0) = 0, a(2*n) = a(n), a(4*n+1) = 1, a(4*n+3) = 1 + a(2*n+1) (the Maple program makes use of these equations). - Emeric Deutsch, Aug 17 2017
EXAMPLE
13 = 1101 so a(13) = 1.
MAPLE
a := proc(n) if n = 0 then 0 elif `mod`(n, 2) = 0 then a((1/2)*n) elif `mod`(n, 4) = 1 then 1 else 1+a((1/2)*n-1/2) end if end proc: seq(a(n), n = 0 .. 104); # Emeric Deutsch, Aug 17 2017
MATHEMATICA
Table[If[n == 0, 0, Length@ Last@ Select[Split@ IntegerDigits[n, 2], First@ # == 1 &]], {n, 0, 104}] (* Michael De Vlieger, Aug 17 2017 *)
PROG
(PARI) a(n) = if (n==0, 0, valuation(n/2^valuation(n, 2)+1, 2)); \\ Ralf Stephan, Aug 31 2013; Michel Marcus, Apr 30 2020
(Python)
def A089309(n): return (~((m:=n>>(~n&n-1).bit_length())+1)&m).bit_length() # Chai Wah Wu, Jul 13 2022
CROSSREFS
Sequence in context: A368010 A237453 A265754 * A126387 A038374 A284569
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Dec 22 2003
EXTENSIONS
More terms from Vladeta Jovovic and John W. Layman, Jan 21 2004
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 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)