OFFSET
1,2
COMMENTS
The number of bits needed to write n using Elias gamma coding. - Charles R Greathouse IV, Mar 21 2012
Consists of the n-th odd number (A005408(n) = 2n+1) repeated 2^(n-1) times (since a(n) = a(n-1) except when a(n) > a(n-1) which happens for n a power of 2). - Jonathan Vos Post, Jun 17 2007
LINKS
Indranil Ghosh, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = Sum_{k=1..n} (-1)^(k-1)*floor(n/k)*mu(k).
PROG
(PARI) a(n)=2*floor(log(n)/log(2))+1
(PARI) a(n)=log(n+.5)\log(2)*2+1 \\ Charles R Greathouse IV, Mar 21 2012
(PARI) a(n)=2*logint(n, 2)+1 \\ Charles R Greathouse IV, Sep 04 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Benoit Cloitre, Jun 13 2007
STATUS
approved