login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A004257
a(n) = round(log_2(n)).
7
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, 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, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
OFFSET
1,3
FORMULA
a(n) = floor(log_2(sqrt(2)*n)). - Velin Yanev, Dec 11 2016
Conjecture: a(n) = A000523(n^2) - A000523(n). - Mikhail Kurkov, Sep 11 2019
MATHEMATICA
Round[Log[2, Range[90]]] (* Harvey P. Dale, Aug 26 2014 *)
PROG
(PARI) a(n) = round(log(n)/log(2)); \\ Michel Marcus, Dec 11 2016
(PARI) a(n) = {logint(n^2, 2) - logint(n, 2)} \\ Andrew Howroyd, Sep 11 2019
(Magma) [Round(Log(2, n)):n in [1..90]]; // Marius A. Burtea, Aug 02 2019
CROSSREFS
Cf. A000523 (floored).
Sequence in context: A227923 A346425 A029836 * A360010 A276611 A238598
KEYWORD
nonn
STATUS
approved