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.

A054390 Number of ways of writing n as a sum of powers of 3, each power being used at most three times.

Original entry on oeis.org

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

Views

Author

John W. Layman, May 09 2000

Keywords

Comments

Let M be an infinite matrix with (1, 1, 1, 1, 0, 0, 0, ...) in each column shifted down thrice from the previous column (for k>0). Then A054390 = lim_{n->infinity} M^n, the left-shifted vector considered as a sequence. - Gary W. Adamson, Apr 14 2010
Conjecture: Number of ways of partitioning n into distinct parts of A038754. - R. J. Mathar, Mar 01 2023

Examples

			a(33) = 4 because we have 33 = 27+3+3 = 27+3+1+1+1 = 9+9+9+3+3 = 9+9+9+3+1+1+1.
		

Crossrefs

Cf. A002487.

Programs

  • Maple
    a[0]:=1: a[1]:=1: a[2]:=1: for n from 1 to 35 do a[3*n]:=a[n]+a[n-1]: a[3*n+1]:=a[n]: a[3*n+2]:=a[n] od: A:=[seq(a[n],n=0..104)]; # Emeric Deutsch, Apr 02 2006
    g:=product((1+x^(3^j)+x^(2*(3^j))+x^(3*(3^j))),j=0..10): gser:=series(g,x=0,125): seq(coeff(gser,x,n),n=0..104); # Emeric Deutsch, Apr 02 2006
    # third Maple program:
    b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<0, 0,
           add(`if`(n-j*3^i<0, 0, b(n-j*3^i, i-1)), j=0..3)))
        end:
    a:= n-> b(n, ilog[3](n)):
    seq(a(n), n=0..100);  # Alois P. Heinz, Jun 21 2012
  • Mathematica
    a[0]=1; a[1]=1; a[2]=1; For[n=1, n <= 35, n++, a[3*n] = a[n] + a[n-1]; a[3*n+1] = a[n]; a[3*n+2] = a[n]]; Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Dec 20 2016, after Emeric Deutsch *)

Formula

a(0)=1, a(1)=1, a(2)=1 and, for n>0, a(3n)=a(n)+a(n-1), a(3n+1)=a(n), a(3n+2)=a(n).
G.f.: Product_{j >= 0} (1+x^(3^j)+x^(2*(3^j))+x^(3*(3^j))). - Emeric Deutsch, Apr 02 2006
G.f. A(x) satisfies: A(x) = (1 + x + x^2 + x^3) * A(x^3). - Ilya Gutkovskiy, Jul 09 2019