OFFSET
0,4
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..10000
FORMULA
a(n) = floor(n*log(3)/log(10)) + 1. E.g., a(10)=5 because 3^10 = 59049 and floor(10*log(3)/log(10)) + 1 = 4 + 1 = 5. - Jaap Spies, Dec 15 2003
MAPLE
seq(floor(n*ln(3)/ln(10))+1, n=0..100);
MATHEMATICA
Table[Length[IntegerDigits[3^n]], {n, 0, 100}] (* T. D. Noe, Mar 20 2012 *)
IntegerLength[3^Range[0, 70]] (* Harvey P. Dale, Jan 28 2015 *)
PROG
(PARI) a(n)=#Str(3^n) \\ Charles R Greathouse IV, Jul 03 2013
(Magma) [#Intseq(3^n): n in [0..100] ]; // Vincenzo Librandi, Jun 23 2015
(Python)
def a(n): return len(str(3**n))
print([a(n) for n in range(70)]) # Michael S. Branicky, Dec 23 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved