A070941 Length of binary representation of 2n+1.
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, 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, 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
Offset: 0
Keywords
Programs
-
Mathematica
Table[IntegerLength[n,2],{n,1,201,2}] (* Harvey P. Dale, May 17 2011 *)
-
PARI
a(n)=length(binary(2*n+1))
-
Python
def A070941(n): return n.bit_length()+1 # Chai Wah Wu, Mar 29 2023
Formula
Let b(1)=1, b(n) = a(n-floor(n/2)) + 1, then a(n) = b(n+1). - Benoit Cloitre, Oct 23 2002
G.f.: 1/(1-x) * (1 + Sum_{k>=0} x^2^k). - Ralf Stephan, Apr 15 2002
a(n) = ceiling(log_2(n+1)) + 1 = A029837(n+1) + 1. - Ralf Stephan, Apr 15 2002
a(n) = ceiling(average of previous entries) + 1. - Jon Perry, Apr 04 2004
Comments