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.

Previous Showing 11-20 of 43 results. Next

A053735 Sum of digits of (n written in base 3).

Original entry on oeis.org

0, 1, 2, 1, 2, 3, 2, 3, 4, 1, 2, 3, 2, 3, 4, 3, 4, 5, 2, 3, 4, 3, 4, 5, 4, 5, 6, 1, 2, 3, 2, 3, 4, 3, 4, 5, 2, 3, 4, 3, 4, 5, 4, 5, 6, 3, 4, 5, 4, 5, 6, 5, 6, 7, 2, 3, 4, 3, 4, 5, 4, 5, 6, 3, 4, 5, 4, 5, 6, 5, 6, 7, 4, 5, 6, 5, 6, 7, 6, 7, 8, 1, 2, 3, 2, 3, 4, 3, 4, 5, 2, 3, 4, 3, 4, 5, 4, 5, 6, 3, 4, 5, 4, 5, 6
Offset: 0

Views

Author

Henry Bottomley, Mar 28 2000

Keywords

Comments

Also the fixed point of the morphism 0->{0,1,2}, 1->{1,2,3}, 2->{2,3,4}, etc. - Robert G. Wilson v, Jul 27 2006

Examples

			a(20) = 2 + 0 + 2 = 4 because 20 is written as 202 base 3.
From _Omar E. Pol_, Feb 20 2010: (Start)
This can be written as a triangle with row lengths A025192 (see the example in the entry A000120):
0,
1,2,
1,2,3,2,3,4,
1,2,3,2,3,4,3,4,5,2,3,4,3,4,5,4,5,6,
1,2,3,2,3,4,3,4,5,2,3,4,3,4,5,4,5,6,3,4,5,4,5,6,5,6,7,2,3,4,3,4,5,4,5,6,3,...
where the k-th row contains a(3^k+i) for 0<=i<2*3^k and converges to A173523 as k->infinity. (End) [Changed conjectures to statements in this entry. - _Franklin T. Adams-Watters_, Jul 02 2015]
G.f. = x + 2*x^2 + x^3 + 2*x^4 + 3*x^5 + 2*x^6 + 3*x^7 + 4*x^8 + x^9 + 2*x^10 + ...
		

Crossrefs

Cf. A065363, A007089, A173523. See A134451 for iterations.
Sum of digits of n written in bases 2-16: A000120, this sequence, A053737, A053824, A053827, A053828, A053829, A053830, A007953, A053831, A053832, A053833, A053834, A053835, A053836.
Related base-3 sequences: A006047, A230641, A230642, A230643, A230853, A230854, A230855, A230856, A230639, A230640, A010063 (trajectory of 1), A286585, A286632, A289813, A289814.

Programs

  • Haskell
    a053735 = sum . a030341_row
    -- Reinhard Zumkeller, Feb 21 2013, Feb 19 2012
    
  • MATLAB
    m=1; for u=0:104; sol(m)=sum(dec2base(u,3)-'0'); m=m+1;end
    sol; % Marius A. Burtea, Jan 17 2019
  • Magma
    [&+Intseq(n,3):n in [0..104]]; // Marius A. Burtea, Jan 17 2019
    
  • Maple
    seq(convert(convert(n,base,3),`+`),n=0..100); # Robert Israel, Jul 02 2015
  • Mathematica
    Table[Plus @@ IntegerDigits[n, 3], {n, 0, 100}] (* or *)
    Nest[Join[#, # + 1, # + 2] &, {0}, 6] (* Robert G. Wilson v, Jul 27 2006 and modified Jul 27 2014 *)
  • PARI
    {a(n) = if( n<1, 0, a(n\3) + n%3)}; /* Michael Somos, Mar 06 2004 */
    
  • PARI
    A053735(n)=sumdigits(n,3) \\ Requires version >= 2.7. Use sum(i=1,#n=digits(n,3),n[i]) in older versions. - M. F. Hasler, Mar 15 2016
    
  • Scheme
    (define (A053735 n) (let loop ((n n) (s 0)) (if (zero? n) s (let ((d (mod n 3))) (loop (/ (- n d) 3) (+ s d)))))) ;; For R6RS standard. Use modulo instead of mod in older Schemes like MIT/GNU Scheme. - Antti Karttunen, Jun 03 2017
    

Formula

From Benoit Cloitre, Dec 19 2002: (Start)
a(0) = 0, a(3n) = a(n), a(3n + 1) = a(n) + 1, a(3n + 2) = a(n) + 2.
a(n) = n - 2*Sum_{k>0} floor(n/3^k) = n - 2*A054861(n). (End)
a(n) = A062756(n) + 2*A081603(n). - Reinhard Zumkeller, Mar 23 2003
G.f.: (Sum_{k >= 0} (x^(3^k) + 2*x^(2*3^k))/(1 + x^(3^k) + x^(2*3^k)))/(1 - x). - Michael Somos, Mar 06 2004, corrected by Franklin T. Adams-Watters, Nov 03 2005
In general, the sum of digits of (n written in base b) has generating function (Sum_{k>=0} (Sum_{0 <= i < b} i*x^(i*b^k))/(Sum_{i=0..b-1} x^(i*b^k)))/(1-x). - Franklin T. Adams-Watters, Nov 03 2005
First differences of A094345. - Vladeta Jovovic, Nov 08 2005
a(A062318(n)) = n and a(m) < n for m < A062318(n). - Reinhard Zumkeller, Feb 26 2008
a(n) = A138530(n,3) for n > 2. - Reinhard Zumkeller, Mar 26 2008
a(n) <= 2*log_3(n+1). - Vladimir Shevelev, Jun 01 2011
a(n) = Sum_{k>=0} A030341(n, k). - Philippe Deléham, Oct 21 2011
G.f. satisfies G(x) = (x+2*x^2)/(1-x^3) + (1+x+x^2)*G(x^3), and has a natural boundary at |x|=1. - Robert Israel, Jul 02 2015
a(n) = A056239(A006047(n)). - Antti Karttunen, Jun 03 2017
a(n) = A000120(A289813(n)) + 2*A000120(A289814(n)). - Antti Karttunen, Jul 20 2017
a(0) = 0; a(n) = a(n - 3^floor(log_3(n))) + 1. - Ilya Gutkovskiy, Aug 23 2019
Sum_{n>=1} a(n)/(n*(n+1)) = 3*log(3)/2 (Shallit, 1984). - Amiram Eldar, Jun 03 2021

A031298 Triangle T(n,k): write n in base 10, reverse order of digits.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 2, 0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7, 3, 8, 3, 9, 3, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 5, 4, 6, 4, 7, 4, 8, 4, 9, 4, 0
Offset: 0

Views

Author

Keywords

Comments

The length of n-th row is given in A055642(n). - Reinhard Zumkeller, Jul 04 2012
According to the formula for T(n,1), columns are numbered starting with 1. One might also number columns starting with the offset 0, as to have the coefficient of 10^k in column k. - M. F. Hasler, Jul 21 2013

Crossrefs

Cf. A030308, A030341, A030386, A031235, A030567, A031007, A031045, A031087 for the base-2 to base-9 analogs.

Programs

  • Haskell
    a031298 n k = a031298_tabf !! n !! k
    a031298_row n = a031298_tabf !! n
    a031298_tabf = iterate succ [0] where
       succ []     = [1]
       succ (9:ds) = 0 : succ ds
       succ (d:ds) = (d + 1) : ds
    -- Reinhard Zumkeller, Jul 04 2012
    
  • Mathematica
    Table[Reverse[IntegerDigits[n]],{n,0,50}]//Flatten (* Harvey P. Dale, Mar 07 2023 *)
  • PARI
    T(n,k)=n\10^(k-1)%10 \\ M. F. Hasler, Jul 21 2013

Formula

T(n,1) = A010879(n); T(n,A055642(n)) = A000030(n). - Reinhard Zumkeller, Jul 04 2012

Extensions

Initial 0 and better name by Philippe Deléham, Oct 20 2011
Edited by M. F. Hasler, Jul 21 2013

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

A003137 Write n in base 3 and juxtapose.

Original entry on oeis.org

1, 2, 1, 0, 1, 1, 1, 2, 2, 0, 2, 1, 2, 2, 1, 0, 0, 1, 0, 1, 1, 0, 2, 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 0, 1, 2, 1, 1, 2, 2, 2, 0, 0, 2, 0, 1, 2, 0, 2, 2, 1, 0, 2, 1, 1, 2, 1, 2, 2, 2, 0, 2, 2, 1, 2, 2, 2, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 2, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 2, 1, 0, 2, 0, 1, 0, 2, 1, 1, 0, 2, 2, 1
Offset: 1

Views

Author

Keywords

Comments

An irregular table in which the n-th row lists the base-3 digits of n, see A007089. - Jason Kimberley, Dec 07 2012
The base-3 Champernowne constant (A077771): it is normal in base 3. - Jason Kimberley, Dec 07 2012

Examples

			1,
2,
1,0,
1,1,
1,2,
2,0,
2,1,
2,2,
1,0,0,
1,0,1,.... _R. J. Mathar_, Aug 16 2021
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Tables in which the n-th row lists the base b digits of n: A030190 and A030302 (b=2), this sequence and A054635 (b=3), A030373 (b=4), A031219 (b=5), A030548 (b=6), A030998 (b=7), A031035 and A054634 (b=8), A031076 (b=9), A007376 and A033307 (b=10). - Jason Kimberley, Dec 06 2012
Cf. A081604 (row lengths), A053735 (row sums), A030341 (rows reversed), A077771, A007089.

Programs

  • Haskell
    a003137 n k = a003137_tabf !! (n-1) !! k
    a003137_row n = a003137_tabf !! (n-1)
    a003137_tabf = map reverse $ tail a030341_tabf
    a003137_list = concat a003137_tabf
    -- Reinhard Zumkeller, Feb 21 2013
    
  • Magma
    &cat[Reverse(IntegerToSequence(n,3)):n in[1..31]]; // Jason Kimberley, Dec 07 2012
    
  • Mathematica
    Flatten@ IntegerDigits[ Range@ 40, 3] (* or *)
    almostNatural[n_, b_] := Block[{m = 0, d = n, i = 1, l, p}, While[m <= d, l = m; m = (b - 1) i*b^(i - 1) + l; i++]; i--; p = Mod[d - l, i]; q = Floor[(d - l)/i] + b^(i - 1); If[p != 0, IntegerDigits[q, b][[p]], Mod[q - 1, b]]]; Array[ a[#, 3] &, 105] (* Robert G. Wilson v, Jul 01 2014 *)
  • Python
    from itertools import count, islice
    from sympy.ntheory.factor_ import digits
    def A003137_gen(): return (d for m in count(1) for d in digits(m,3)[1:])
    A003137_list = list(islice(A003137_gen(),30)) # Chai Wah Wu, Jan 07 2022

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Sep 25 2000

A030102 Base-3 reversal of n (written in base 10).

Original entry on oeis.org

0, 1, 2, 1, 4, 7, 2, 5, 8, 1, 10, 19, 4, 13, 22, 7, 16, 25, 2, 11, 20, 5, 14, 23, 8, 17, 26, 1, 28, 55, 10, 37, 64, 19, 46, 73, 4, 31, 58, 13, 40, 67, 22, 49, 76, 7, 34, 61, 16, 43, 70, 25, 52, 79, 2, 29, 56, 11, 38, 65, 20, 47, 74, 5, 32, 59, 14, 41, 68, 23, 50, 77, 8, 35, 62, 17, 44, 71
Offset: 0

Views

Author

Keywords

Examples

			a(17) = 25 because 17 in base 3 is 122, and backwards that is 221, which is 25 in base 10.
a(18) = 2 because 18 in base 3 is 200, and backwards that is 2.
		

Crossrefs

Cf. A030341.
Cf. A263273 for a bijective variant.

Programs

  • Haskell
    a030102 = foldl (\v d -> 3 * v + d) 0 . a030341_row
    -- Reinhard Zumkeller, Dec 16 2013
  • Maple
    a030102:= proc(n) option remember;
      local y;
      y:= n mod 3;
      3^ilog[3](n)*y + procname((n-y)/3)
    end proc:
    for i from 0 to 2 do a030102(i):= i od:
    seq(a030102(i),i=0..100); # Robert Israel, Dec 24 2015
    # alternative
    A030102 := proc(n)
        local r ;
        r := ListTools[Reverse](convert(n,base,3)) ;
        add(op(i,r)*3^(i-1),i=1..nops(r)) ;
    end proc: # R. J. Mathar, May 28 2016
  • Mathematica
    A030102[n_] := FromDigits[Reverse@IntegerDigits[n, 3], 3] (* JungHwan Min, Dec 23 2015 *)
    FromDigits[#,3]&/@(Reverse/@IntegerDigits[Range[0,80],3]) (* Harvey P. Dale, Feb 05 2020 *)
  • PARI
    a(n,b=3)=subst(Polrev(base(n,b)),x,b) /* where */
    base(n,b)={my(a=[n%b]);while(0M. F. Hasler, Nov 04 2011
    
  • PARI
    a(n) = fromdigits(Vecrev(digits(n, 3)), 3); \\ Michel Marcus, Oct 10 2017
    

Formula

a(n) = t(n,0) with t(n,r) = if n=0 then r else t(floor(n/3),r*3+(n mod 3)). - Reinhard Zumkeller, Mar 04 2010
G.f. G(x) satisfies: G(x) = (1+x+x^2)*G(x^3) - (1+2*x)*(x + 2*Sum_{m>=0} 3^m*x^(3^(m+1)+1)/(x^3-1). - Robert Israel, Dec 24 2015

A030567 Triangle T(n,k): Write n in base 6 and reverse order of digits to get row n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 2, 0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 5, 3, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 5, 4, 0, 5, 1, 5, 2, 5, 3, 5, 4, 5, 5, 5, 0, 0, 1, 1, 0, 1, 2, 0, 1, 3, 0, 1, 4, 0, 1, 5, 0, 1, 0, 1, 1, 1, 1, 1, 2
Offset: 0

Views

Author

Keywords

Comments

If columns are numbered starting with k=0, then T(n,k) contains the coefficient of 6^k in n's base-6 expansion. - M. F. Hasler, Jul 21 2013

Crossrefs

See A030548 for a quite complete list of crossreferences.
Cf. A030568 - A030573 for positions of a given digit.
Cf. A030575 - A030580 for run lengths, A030581 - A030585 for more.
Row sums (same as those of A030548) are in A053827.
Cf. A030308, A030341, A030386, A031235, A031007, A031045, A031087, A031298 for the base-2 to base-10 analogs.

Programs

  • Mathematica
    Flatten[Table[Reverse[IntegerDigits[n,6]],{n,0,50}]] (* Harvey P. Dale, Sep 27 2015 *)
  • PARI
    A030567(n,k=-1)=/*k<0&&error("Flattened sequence not yet implemented.")*/n\6^k%6 \\ Assuming that columns start with k=0, cf. comment. TO DO: implement flattened sequence, such that A030567(n)=a(n). - M. F. Hasler, Jul 21 2013

Extensions

Initial 0 and better name from Philippe Deléham, Oct 20 2011
Edited and crossrefs added by M. F. Hasler, Jul 21 2013

A047217 Numbers that are congruent to {0, 1, 2} mod 5.

Original entry on oeis.org

0, 1, 2, 5, 6, 7, 10, 11, 12, 15, 16, 17, 20, 21, 22, 25, 26, 27, 30, 31, 32, 35, 36, 37, 40, 41, 42, 45, 46, 47, 50, 51, 52, 55, 56, 57, 60, 61, 62, 65, 66, 67, 70, 71, 72, 75, 76, 77, 80, 81, 82, 85, 86, 87, 90, 91, 92, 95, 96, 97, 100, 101, 102, 105, 106, 107, 110, 111
Offset: 1

Views

Author

Keywords

Comments

Also, the only numbers that are eligible to be the sum of two 4th powers (A004831). - Cino Hilliard, Nov 23 2003
Nonnegative m such that floor(2*m/5) = 2*floor(m/5). - Bruno Berselli, Dec 09 2015
The sequence lists the indices of the multiples of 5 in A007531. - Bruno Berselli, Jan 05 2018

Crossrefs

Cf. A007531, A030341, A004831 (two 4th powers).
Cf. similar sequences with formula n+i*floor(n/3) listed in A281899.

Programs

  • Magma
    I:=[0, 1, 2, 5]; [n le 4 select I[n] else Self(n-1)+Self(n-3)-Self(n-4): n in [1..70]]; // Vincenzo Librandi, Apr 25 2012
    
  • Magma
    &cat [[5*n,5*n+1,5*n+2]: n in [0..30]]; // Bruno Berselli, Dec 09 2015
  • Maple
    seq(op([5*i,5*i+1,5*i+2]),i=0..100); # Robert Israel, Sep 02 2014
  • Mathematica
    Select[Range[0,120], MemberQ[{0,1,2}, Mod[#,5]]&] (* Harvey P. Dale, Jan 20 2012 *)
  • PARI
    a(n)=n--\3*5+n%3 \\ Charles R Greathouse IV, Oct 22 2011
    
  • PARI
    concat(0, Vec(x^2*(1+x+3*x^2)/(1-x)^2/(1+x+x^2) + O(x^100))) \\ Altug Alkan, Dec 09 2015
    
  • PARI
    is(n) = n%5 < 3 \\ Felix Fröhlich, Jan 05 2018
    

Formula

a(n+1) = Sum_{k>=0} A030341(n,k)*b(k) with b(0)=1 and b(k)=5*3^(k-1) for k>0. - Philippe Deléham, Oct 22 2011
G.f.: x^2*(1+x+3*x^2)/(1-x)^2/(1+x+x^2). - Colin Barker, Feb 17 2012
a(n) = 5 + a(n-3) for n>3. - Robert Israel, Sep 02 2014
a(n) = floor((5/4)*floor(4*(n-1)/3)). - Bruno Berselli, May 03 2016
From Wesley Ivan Hurt, Jun 14 2016: (Start)
a(n) = a(n-1) + a(n-3) - a(n-4) for n>4.
a(n) = (15*n-21-6*cos(2*n*Pi/3)+2*sqrt(3)*sin(2*n*Pi/3))/9.
a(3*k) = 5*k-3, a(3*k-1) = 5*k-4, a(3*k-2) = 5*k-5. (End)
a(n) = n - 1 + 2*floor((n-1)/3). - Bruno Berselli, Feb 06 2017
Sum_{n>=2} (-1)^n/a(n) = sqrt(1-2/sqrt(5))*Pi/5 + 3*log(2)/5. - Amiram Eldar, Dec 10 2021

A031235 Triangle T(n,k): write n in base 5, reverse order of digits.

Original entry on oeis.org

0, 1, 2, 3, 4, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 0, 0, 1, 1, 0, 1, 2, 0, 1, 3, 0, 1, 4, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 1, 4, 1, 1, 0, 2, 1, 1, 2, 1, 2, 2, 1, 3, 2, 1, 4, 2, 1, 0
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A030308, A030341, A030386, A030567, A031007, A031045, A031087, A031298 for the base-2 to base-10 analogs.
Cf. A007091.

Programs

  • Haskell
    a031235 n k = a031235_tabf !! n !! k
    a031235_row n = a031235_tabf !! n
    a031235_tabf = iterate succ [0] where
       succ []     = [1]
       succ (4:ts) = 0 : succ ts
       succ (t:ts) = (t + 1) : ts
    -- Reinhard Zumkeller, Sep 18 2015
  • Mathematica
    Reverse[IntegerDigits[#,5]]&/@Range[0,40]//Flatten (* Harvey P. Dale, Aug 02 2016 *)
  • PARI
    A031235(n, k=-1)=/*k<0&&error("Flattened sequence not yet implemented.")*/n\5^k%5 \\ Assuming that columns are numbered starting with k=0 as in A030308, A030341, ... - M. F. Hasler, Jul 21 2013
    

Extensions

Initial 0 and better name by Philippe Deléham, Oct 20 2011

A004128 a(n) = Sum_{k=1..n} floor(3*n/3^k).

Original entry on oeis.org

0, 1, 2, 4, 5, 6, 8, 9, 10, 13, 14, 15, 17, 18, 19, 21, 22, 23, 26, 27, 28, 30, 31, 32, 34, 35, 36, 40, 41, 42, 44, 45, 46, 48, 49, 50, 53, 54, 55, 57, 58, 59, 61, 62, 63, 66, 67, 68, 70, 71, 72, 74, 75, 76, 80, 81, 82, 84, 85, 86, 88, 89, 90, 93, 94, 95, 97, 98, 99, 101, 102
Offset: 0

Views

Author

Keywords

Comments

3-adic valuation of (3n)!; cf. A054861.
Denominators of expansion of (1-x)^{-1/3} are 3^a(n). Numerators are in |A067622|.

References

  • Gary W. Adamson, in "Beyond Measure, A Guided Tour Through Nature, Myth and Number", by Jay Kappraff, World Scientific, 2002, p. 356.

Crossrefs

Programs

  • 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
    
  • Maple
    A004128 := proc(n)
        A054861(3*n) ;
    end proc:
    seq(A004128(n),n=0..100) ; # R. J. Mathar, Nov 04 2017
  • 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 *)
  • PARI
    {a(n) = my(s, t=1); while(t<=n, s += n\t; t*=3);s}; /* Michael Somos, Feb 26 2004 */
    
  • PARI
    a(n) = (3*n-sumdigits(n,3))/2; \\ Christian Krause, Jun 10 2025
    
  • Python
    def A007949(n):
        c = 0
        while not (a:=divmod(n,3))[1]:
            c += 1
            n = a[0]
        return c
    def A004128(n): return n+sum(A007949(i) for i in range(3,n+1)) # Chai Wah Wu, Feb 28 2025
  • Sage
    A004128 = lambda n: A004128(n//3) + n if n > 0 else 0
    [A004128(n) for n in (0..70)]  # Peter Luschny, Nov 16 2012
    

Formula

A051064(n) = a(n+1) - a(n). - Alford Arnold, Jul 19 2000
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) = Sum_{k>=0} A030341(n,k)*A003462(k+1). - Philippe Deléham, Oct 21 2011
a(n) ~ 3*n/2 - log(n)/(2*log(3)). - Vaclav Kotesovec, Oct 17 2019

Extensions

Current definition suggested by Jason Earls, Jul 04 2001

A030386 Triangle T(n,k): write n in base 4, reverse order of digits.

Original entry on oeis.org

0, 1, 2, 3, 0, 1, 1, 1, 2, 1, 3, 1, 0, 2, 1, 2, 2, 2, 3, 2, 0, 3, 1, 3, 2, 3, 3, 3, 0, 0, 1, 1, 0, 1, 2, 0, 1, 3, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 1, 0, 2, 1, 1, 2, 1, 2, 2, 1, 3, 2, 1, 0, 3, 1, 1, 3, 1, 2, 3, 1, 3, 3, 1, 0, 0, 2, 1, 0, 2, 2, 0, 2, 3, 0, 2, 0, 1, 2
Offset: 0

Views

Author

Keywords

Examples

			Triangle begins:
0
1
2
3
0, 1
1, 1
2, 1
3, 1
0, 2
1, 2
2, 2
3, 2
0, 3
1, 3
2, 3
3, 3
0, 0, 1
1, 0, 1 ... - _Philippe Deléham_, Oct 20 2011
		

Crossrefs

Cf. A030308, A030341, A031235, A030567, A031007, A031045, A031087, A031298 for the base-2 to base-10 analogs.
Cf. A007090.

Programs

  • Haskell
    a030386 n k = a030386_tabf !! n !! k
    a030386_row n = a030386_tabf !! n
    a030386_tabf = iterate succ [0] where
       succ []     = [1]
       succ (3:ts) = 0 : succ ts
       succ (t:ts) = (t + 1) : ts
    -- Reinhard Zumkeller, Sep 18 2015
  • Maple
    A030386_row := n -> op(convert(n, base, 4)):
    seq(A030386_row(n), n=0..36); # Peter Luschny, Nov 28 2017
  • Mathematica
    Flatten[Table[Reverse[IntegerDigits[n,4]],{n,0,50}]] (* Harvey P. Dale, Oct 13 2012 *)
  • PARI
    A030386(n, k=-1)=/*k<0&&error("Flattened sequence not yet implemented.")*/n\4^k%4 \\ Assuming that columns are numbered starting with k=0 as in A030308, A030341, ... \\ M. F. Hasler, Jul 21 2013
    

Extensions

Initial 0 and better name by Philippe Deléham, Oct 20 2011
Previous Showing 11-20 of 43 results. Next