|
|
A081604
|
|
Number of digits in ternary representation of n.
|
|
37
|
|
|
1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 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, 5
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
COMMENTS
|
|
|
LINKS
|
Eric Weisstein's World of Mathematics, Ternary.
|
|
FORMULA
|
a(n+1) = -Sum_{k=1..n} mu(3*k)*floor(n/k). - Benoit Cloitre, Oct 21 2009
a(n) = floor(log_3(n)) + 1. - Can Atilgan and Murat Erşen Berberler, Dec 05 2012
|
|
EXAMPLE
|
a(8) = 2 because 8 = 22_3, having 2 digits.
a(9) = 3 because 9 = 100_3, having 3 digits.
|
|
MAPLE
|
max(1, 1+ilog[3](n)) ;
|
|
MATHEMATICA
|
Table[Length[IntegerDigits[n, 3]], {n, 0, 99}] (* Alonso del Arte, Dec 30 2012 *)
Join[{1}, IntegerLength[Range[120], 3]] (* Harvey P. Dale, Apr 07 2019 *)
|
|
PROG
|
(Haskell)
a081604 n = if n < 3 then 1 else a081604 (div n 3) + 1
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|