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”).

A129344
a(n) is the number of powers of 2 that have n decimal digits.
4
4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 3, 4, 3, 3
OFFSET
1,1
COMMENTS
Ignoring the first term, first differences of A066343. - Andrew Woods, Jun 10 2013
LINKS
FORMULA
For n>1, a(n) = floor(n*L)-floor((n-1)*L) where L = log(10)/log(2). - Andrew Woods, Jun 10 2013
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = log_2(10) (A020862). - Amiram Eldar, Apr 09 2021
EXAMPLE
a(1) is 4 because there are 4 one-digit powers of 2: 1, 2, 4, 8.
MATHEMATICA
Table[Transpose[ Select[Table[{n, 2^n}, {n, 0, 310}], IntegerDigits[ #[[2]]][[1]] == 1 &]][[1]][[k]] - Transpose[ Select[Table[{n, 2^n}, {n, 0, 310}], IntegerDigits[ #[[2]]][[1]] == 1 &]][[1]][[k - 1]], {k, 2, 94}]
Join[{4}, Differences @ Table[Floor[n*Log2[10]], {n, 100}]] (* Amiram Eldar, Apr 09 2021 *)
PROG
(PARI) a(n) = my(k=0, i=0); while(#Str(2^k)!=n, k++); while(#Str(2^k)==n, i++; k++); i \\ Felix Fröhlich, Jan 19 2016
(Python)
def A129344(n): return -(m:=5**(n-1)).bit_length()+(5*m).bit_length()+1 if n>1 else 4 # Chai Wah Wu, Sep 08 2024
CROSSREFS
First differences of A067497.
Sequence in context: A026858 A188885 A362330 * A048853 A303701 A179845
KEYWORD
base,nonn
AUTHOR
Tanya Khovanova, May 28 2007
STATUS
approved