login
Length of binary representation of 2n+1.
22

%I #34 Mar 30 2023 01:49:56

%S 1,2,3,3,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,

%T 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,

%U 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8

%N Length of binary representation of 2n+1.

%C Sequence consists of A011782(n) n+1's. - _Jon Perry_, Apr 04 2004

%C For n > 0: a(n) = A003314(n+1) - A003314(n) = A123753(n) - A123753(n-1). - _Reinhard Zumkeller_, Oct 12 2006

%C For k >= 2, k appears 2^(k-2) times consecutively. - _Bernard Schott_, Jun 08 2019

%C Also length of binary representation of 2n. - _Michel Marcus_, Oct 28 2020

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F Let b(1)=1, b(n) = a(n-floor(n/2)) + 1, then a(n) = b(n+1). - _Benoit Cloitre_, Oct 23 2002

%F G.f.: 1/(1-x) * (1 + Sum_{k>=0} x^2^k). - _Ralf Stephan_, Apr 15 2002

%F a(n) = ceiling(log_2(n+1)) + 1 = A029837(n+1) + 1. - _Ralf Stephan_, Apr 15 2002

%F a(n) = ceiling(average of previous entries) + 1. - _Jon Perry_, Apr 04 2004

%t Table[IntegerLength[n,2],{n,1,201,2}] (* _Harvey P. Dale_, May 17 2011 *)

%o (PARI) a(n)=length(binary(2*n+1))

%o (Python)

%o def A070941(n): return n.bit_length()+1 # _Chai Wah Wu_, Mar 29 2023

%Y Bisection of A070939 and also of A070940.

%K nonn

%O 0,2

%A _N. J. A. Sloane_, May 18 2002