OFFSET
0,3
COMMENTS
REFERENCES
Gary W. Adamson, in "Beyond Measure, A Guided Tour Through Nature, Myth and Number", by Jay Kappraff, World Scientific, 2002, p. 356.
LINKS
T. D. Noe, Table of n, a(n) for n = 0..1000
Vaclav Kotesovec, Graph - the asymptotic ratio (100000 terms)
FORMULA
a(n) = n + floor(n/3) + floor(n/9) + floor(n/27) + ... = n + a(floor(n/3)) = n + A054861(n) = A054861(3n) = (3*n - A053735(n))/2. - Henry Bottomley, May 01 2001
a(n) = Sum_{k>=0} floor(n/3^k). a(n) = Sum_{k=0..floor(log_3(n))} floor(n/3^k), n >= 1. - Hieronymus Fischer, Aug 14 2007
Recurrence: a(n) = n + a(floor(n/3)); a(3n) = 3*n + a(n); a(n*3^m) = 3*n*(3^m-1)/2 + a(n). - Hieronymus Fischer, Aug 14 2007
a(k*3^m) = k*(3^(m+1)-1)/2, 0 <= k < 3, m >= 0. - Hieronymus Fischer, Aug 14 2007
Asymptotic behavior: a(n) = (3/2)*n + O(log(n)), a(n+1) - a(n) = O(log(n)); this follows from the inequalities below. - Hieronymus Fischer, Aug 14 2007
a(n) <= (3n-1)/2; equality holds for powers of 3. - Hieronymus Fischer, Aug 14 2007
a(n) >= (3n-2)/2 - floor(log_3(n)); equality holds for n = 3^m - 1, m > 0. - Hieronymus Fischer, Aug 14 2007
Lim inf (3n/2 - a(n)) = 1/2, for n->oo. - Hieronymus Fischer, Aug 14 2007
Lim sup (3n/2 - log_3(n) - a(n)) = 0, for n->oo. - Hieronymus Fischer, Aug 14 2007
Lim sup (a(n+1) - a(n) - log_3(n)) = 1, for n->oo. - Hieronymus Fischer, Aug 14 2007
G.f.: (Sum_{k>=0} x^(3^k)/(1-x^(3^k)))/(1-x). - Hieronymus Fischer, Aug 14 2007
a(n) ~ 3*n/2 - log(n)/(2*log(3)). - Vaclav Kotesovec, Oct 17 2019
MAPLE
MATHEMATICA
Table[Total[NestWhileList[Floor[#/3] &, n, # > 0 &]], {n, 0, 70}] (* Birkas Gyorgy, May 20 2012 *)
A004128 = Log[3, CoefficientList[ Series[1/(1+x)^(1/3), {x, 0, 100}], x] // Denominator] (* Jean-François Alcover, Feb 19 2015 *)
Flatten[{0, Accumulate[Table[IntegerExponent[3*n, 3], {n, 1, 100}]]}] (* Vaclav Kotesovec, Oct 17 2019 *)
PROG
(PARI) {a(n) = my(s, t=1); while(t<=n, s += n\t; t*=3); s}; /*Michael Somos, Feb 26 2004 */
(Sage)
[A004128(n) for n in (0..70)] # Peter Luschny, Nov 16 2012
(Haskell)
a004128 n = a004128_list !! (n-1)
a004128_list = scanl (+) 0 a051064_list
-- Reinhard Zumkeller, May 23 2013
(Magma) [n + Valuation(Factorial(n), 3): n in [0..70]]; // Vincenzo Librandi, Jun 12 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Current definition suggested by Jason Earls, Jul 04 2001
STATUS
approved