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

%I #38 Mar 01 2023 09:08:40

%S 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,

%T 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,

%U 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

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

%C 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

%C Conjecture: Number of ways of partitioning n into distinct parts of A038754. - _R. J. Mathar_, Mar 01 2023

%H Alois P. Heinz, <a href="/A054390/b054390.txt">Table of n, a(n) for n = 0..10000</a>

%H Karl Dilcher, Larry Ericksen, <a href="https://www.emis.de/journals/JIS/VOL21/Dilcher/dilcher7.html">Polynomials Characterizing Hyper b-ary Representations</a>, J. Int. Seq., Vol. 21 (2018), Article 18.4.3.

%H Timothy B. Flowers, <a href="https://www.emis.de/journals/JIS/VOL20/Flowers/flowers3.html">Extending a Recent Result on Hyper m-ary Partition Sequences</a>, Journal of Integer Sequences, Vol. 20 (2017), #17.6.7.

%F 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).

%F G.f.: Product_{j >= 0} (1+x^(3^j)+x^(2*(3^j))+x^(3*(3^j))). - _Emeric Deutsch_, Apr 02 2006

%F G.f. A(x) satisfies: A(x) = (1 + x + x^2 + x^3) * A(x^3). - _Ilya Gutkovskiy_, Jul 09 2019

%e 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.

%p 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

%p 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

%p # third Maple program:

%p b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<0, 0,

%p add(`if`(n-j*3^i<0, 0, b(n-j*3^i, i-1)), j=0..3)))

%p end:

%p a:= n-> b(n, ilog[3](n)):

%p seq(a(n), n=0..100); # _Alois P. Heinz_, Jun 21 2012

%t 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_ *)

%Y Cf. A002487.

%K nonn,look

%O 0,4

%A _John W. Layman_, May 09 2000