%I #42 Apr 27 2020 06:22:47
%S 1,1,1,1,2,1,1,2,3,1,1,2,3,4,1,1,2,3,5,5,1,1,2,3,5,7,6,1,1,2,3,5,7,9,
%T 7,1,1,2,3,5,7,9,12,8,1,1,2,3,5,7,9,12,15,9,1,1,2,3,5,7,9,12,15,18,10,
%U 1,1,2,3,5,7,9,12,15,18,22,11,1,1,2,3,5,7,9,12,15,18,23,26,12,1
%N Square array A(n,k), n >= 0, k >= 0, read by antidiagonals: A(n,k) is the number of partitions of 3*n into powers of 3 less than or equal to 3^k.
%C Column sequences converge to A005704.
%H Serguei Zolotov, <a href="/A306727/b306727.txt">Table of n, a(n) for n = 0..10584</a>
%F G.f. of column k: 1/(1-x) * 1/Product_{j=0..k-1} (1 - x^(3^j)).
%e A(3,3) = 5, because there are 5 partitions of 3*3=9 into powers of 3 less than or equal to 3^3=9: [9], [3,3,3], [3,3,1,1,1], [3,1,1,1,1,1,1], [1,1,1,1,1,1,1,1,1].
%e Square array A(n,k) begins:
%e 1, 1, 1, 1, 1, 1, ...
%e 1, 2, 2, 2, 2, 2, ...
%e 1, 3, 3, 3, 3, 3, ...
%e 1, 4, 5, 5, 5, 5, ...
%e 1, 5, 7, 7, 7, 7, ...
%e 1, 6, 9, 9, 9, 9, ...
%t nmax = 12;
%t f[k_] := f[k] = 1/(1-x) 1/Product[1-x^(3^j), {j, 0, k-1}] + O[x]^(nmax+1) // CoefficientList[#, x]&;
%t A[n_, k_] := f[k][[n+1]];
%t Table[A[n-k, k], {n, 0, nmax}, {k, n, 0, -1}] // Flatten (* _Jean-François Alcover_, Nov 20 2019 *)
%o (Python)
%o def aseq(p, x, k):
%o # generic algorithm for any p - power base, p=3 for this sequence
%o if x < 0:
%o return 0
%o if x < p:
%o return 1
%o # coefficients
%o arr = [0]*(x+1)
%o arr[0] = 1
%o m = p**k
%o while m > 0:
%o for i in range(m, x+1, m):
%o arr[i] += arr[i-m]
%o m //= p
%o return arr[x]
%o def A(n, k):
%o p = 3
%o return aseq(p, p*n, k)
%o # A(n, k), 5 = A(3, 3) = aseq(3, 3*3, 3)
%o # _Serguei Zolotov_, Mar 13 2019
%Y Main diagonal gives A005704.
%Y A181322 gives array for base p=2.
%K nonn,tabl
%O 0,5
%A _Serguei Zolotov_, Mar 06 2019
|