login
a(n) = round(log_2(n)).
7

%I #47 Apr 26 2024 02:37:36

%S 0,1,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,

%T 5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,

%U 6,6,6,6,6,6,6,6,6,6,6,6,6

%N a(n) = round(log_2(n)).

%H T. D. Noe, <a href="/A004257/b004257.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = floor(log_2(sqrt(2)*n)). - _Velin Yanev_, Dec 11 2016

%F Conjecture: a(n) = A000523(n^2) - A000523(n). - _Mikhail Kurkov_, Sep 11 2019

%t Round[Log[2,Range[90]]] (* _Harvey P. Dale_, Aug 26 2014 *)

%o (PARI) a(n) = round(log(n)/log(2)); \\ _Michel Marcus_, Dec 11 2016

%o (PARI) a(n) = {logint(n^2,2) - logint(n,2)} \\ _Andrew Howroyd_, Sep 11 2019

%o (Magma) [Round(Log(2,n)):n in [1..90]]; // _Marius A. Burtea_, Aug 02 2019

%Y Cf. A000523 (floored).

%K nonn

%O 1,3

%A _N. J. A. Sloane_