A054390 Number of ways of writing n as a sum of powers of 3, each power being used at most three times.
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
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.
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..10000
- Karl Dilcher, Larry Ericksen, Polynomials Characterizing Hyper b-ary Representations, J. Int. Seq., Vol. 21 (2018), Article 18.4.3.
- Timothy B. Flowers, Extending a Recent Result on Hyper m-ary Partition Sequences, Journal of Integer Sequences, Vol. 20 (2017), #17.6.7.
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
Comments