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.

A306727 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.

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

Serguei Zolotov, Mar 06 2019

Keywords

Comments

Column sequences converge to A005704.

Examples

			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].
Square array A(n,k) begins:
  1, 1, 1, 1, 1, 1,  ...
  1, 2, 2, 2, 2, 2,  ...
  1, 3, 3, 3, 3, 3,  ...
  1, 4, 5, 5, 5, 5,  ...
  1, 5, 7, 7, 7, 7,  ...
  1, 6, 9, 9, 9, 9,  ...
		

Crossrefs

Main diagonal gives A005704.
A181322 gives array for base p=2.

Programs

  • Mathematica
    nmax = 12;
    f[k_] := f[k] = 1/(1-x) 1/Product[1-x^(3^j), {j, 0, k-1}] + O[x]^(nmax+1) // CoefficientList[#, x]&;
    A[n_, k_] := f[k][[n+1]];
    Table[A[n-k, k], {n, 0, nmax}, {k, n, 0, -1}] // Flatten (* Jean-François Alcover, Nov 20 2019 *)
  • Python
    def aseq(p, x, k):
        # generic algorithm for any p - power base, p=3 for this sequence
        if x < 0:
            return 0
        if x < p:
            return 1
        # coefficients
        arr = [0]*(x+1)
        arr[0] = 1
        m = p**k
        while m > 0:
            for i in range(m, x+1, m):
                arr[i] += arr[i-m]
            m //= p
        return arr[x]
    def A(n, k):
        p = 3
        return aseq(p, p*n, k)
    # A(n, k), 5 = A(3, 3) = aseq(3, 3*3, 3)
    # Serguei Zolotov, Mar 13 2019

Formula

G.f. of column k: 1/(1-x) * 1/Product_{j=0..k-1} (1 - x^(3^j)).