cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A089309 Write n in binary; a(n) = length of the rightmost run of 1's.

This page as a plain text file.
%I A089309 #50 Jul 13 2022 10:17:56
%S A089309 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,
%T A089309 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,
%U A089309 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
%N A089309 Write n in binary; a(n) = length of the rightmost run of 1's.
%C A089309 Equivalent to: remove trailing zeros, add one, count trailing zeros. - _Ralf Stephan_, Aug 31 2013
%C A089309 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
%H A089309 Alois P. Heinz, <a href="/A089309/b089309.txt">Table of n, a(n) for n = 0..16384</a>
%H A089309 Francis Laclé, <a href="https://hal.archives-ouvertes.fr/hal-03201180v2">2-adic parity explorations of the 3n+ 1 problem</a>, hal-03201180v2 [cs.DM], 2021.
%H A089309 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A089309 a(2*n) = a(n), a(2*n+1) = A007814(2*n+2) = A001511(n+1). - _Ralf Stephan_, Jan 31 2004
%F A089309 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
%e A089309 13 = 1101 so a(13) = 1.
%p A089309 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
%t A089309 Table[If[n == 0, 0, Length@ Last@ Select[Split@ IntegerDigits[n, 2], First@ # == 1 &]], {n, 0, 104}] (* _Michael De Vlieger_, Aug 17 2017 *)
%o A089309 (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
%o A089309 (Python)
%o A089309 def A089309(n): return (~((m:=n>>(~n&n-1).bit_length())+1)&m).bit_length() # _Chai Wah Wu_, Jul 13 2022
%Y A089309 Cf. A089310, A089311, A089312, A089313.
%K A089309 nonn,base
%O A089309 0,4
%A A089309 _N. J. A. Sloane_, Dec 22 2003
%E A089309 More terms from _Vladeta Jovovic_ and _John W. Layman_, Jan 21 2004