cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A081604 Number of digits in ternary representation of n.

Original entry on oeis.org

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
Offset: 0

Views

Author

Reinhard Zumkeller, Mar 23 2003

Keywords

Comments

a(n) is the length of row n in table A054635. - Reinhard Zumkeller, Sep 05 2014

Examples

			a(8) = 2 because 8 = 22_3, having 2 digits.
a(9) = 3 because 9 = 100_3, having 3 digits.
		

Crossrefs

Programs

  • Haskell
    a081604 n = if n < 3 then 1 else a081604 (div n 3) + 1
    -- Reinhard Zumkeller, Sep 05 2014, Feb 21 2013
  • Maple
    A081604 := proc(n)
        max(1,1+ilog[3](n)) ;
    end proc: # R. J. Mathar, Jul 12 2016
  • 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 *)

Formula

a(n) = A062153(n) + 1 for n >= 1.
a(n) = A077267(n) + A062756(n) + A081603(n);
From Reinhard Zumkeller, Oct 19 2007: (Start)
0 <= A134021(n) - a(n) <= 1;
a(A134025(n)) = A134021(A134025(n));
a(A134026(n)) = A134021(A134026(n)) - 1. (End)
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
a(n) = if n < 3 then 1 else a(floor(n/3)) + 1. - Reinhard Zumkeller, Sep 05 2014
G.f.: 1 + (1/(1 - x))*Sum_{k>=0} x^(3^k). - Ilya Gutkovskiy, Jan 08 2017