A062153 a(n) = floor(log_3(n)).
0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 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
Offset: 1
Links
- Harry J. Smith, Table of n, a(n) for n = 1..1000
Programs
-
Magma
[ Ilog(3,n) : n in [1..100] ]; // N. J. A. Sloane, Dec 23 2006
-
Mathematica
Floor[Log[3,Range[120]]] (* Harvey P. Dale, Apr 30 2011 *)
-
PARI
a(n)=logint(n,3) \\ Charles R Greathouse IV, Nov 15 2022
Formula
a(n) = (number of digits of n when written in base 3) - 1.
a(n) = if n > 2 then a(floor(n / 3)) + 1 else 0. - Reinhard Zumkeller, Oct 29 2001
G.f.: (1/(1 - x))*Sum_{k>=1} x^(3^k). - Ilya Gutkovskiy, Jan 08 2017