OFFSET
0,5
COMMENTS
To clarify our terminology: We say T is the convolution triangle of a (or T is the partition transform of a), if a is a sequence of integers defined for n >= 1, and the transformation, as defined by the Maple function below, applied to a, returns T. In the generated lower triangular matrix T, i.e., in the convolution triangle of a, T(n, 1) = a(n) for n >= 1.
For instance, let a(n) = Bell(n), then we call A357583 the convolution triangle of the Bell numbers, but not A205574, which is also called the "Bell convolution triangle" in the comments but leads to a different triangle. Similarly, if a(n) = n!, then A090238 is the convolution triangle of the factorial numbers, not A084938. Third example: A128899 is the convolution triangle of the Catalan numbers in our setup, not A059365. More generally, we recommend that when computing the transform of a 0-based sequence to use only the terms for n >= 1 and not to shift the sequence.
Note that T is (0, 0)-based and the first column of a convolution triangle always is 1, 0, 0, 0, ... and the main diagonal is 1, 1, 1, 1, ... if a(1) = 1. The (1, 1)-based subtriangle of a genuine convolution triangle, i.e., a convolution triangle without column 0 and row 0, is often used in place of the convolution triangle but does not fit well into some applications of the convolution triangles.
LINKS
Donald E. Knuth, Convolution polynomials, arXiv:math/9207221 [math.CA]; Mathematica J. 2.1 (1992), no. 4, 67-78.
Peter Luschny, The P-transform.
Cormac O'Sullivan, De Moivre and Bell polynomials, arXiv:2203.02868 [math.CO], 2022.
EXAMPLE
Triangle T(n, k) starts:
[0] 1;
[1] 0, 1;
[2] 0, 2, 1;
[3] 0, 3, 4, 1;
[4] 0, 1, 10, 6, 1;
[5] 0, 5, 14, 21, 8, 1;
[6] 0, 1, 23, 47, 36, 10, 1;
[7] 0, 7, 28, 90, 108, 55, 12, 1;
[8] 0, 1, 49, 147, 258, 205, 78, 14, 1;
[9] 0, 1, 46, 249, 520, 595, 346, 105, 16, 1;
MAPLE
PMatrix := proc(dim, a) local n, k, m, g, M, A;
if n = 0 then return [1] fi;
A := [seq(a(i), i = 1..dim-1)];
M := Matrix(dim, shape=triangular[lower]); M[1, 1] := 1;
for m from 2 to dim do
M[m, m] := M[m - 1, m - 1] * A[1];
for k from m-1 by -1 to 2 do
M[m, k] := add(A[i]*M[m-i, k-1], i = 1..m-k+1)
od od; M end:
a := n -> if isprime(n) then n else 1 fi: PMatrix(10, a);
# Alternatively, as the coefficients of row polynomials:
P := proc(n, x, a) option remember; ifelse(n = 0, 1,
x*add(a(n - k)*P(k, x, a), k = 0..n-1)) end:
Pcoeffs := proc(n, a) seq(coeff(P(n, x, a), x, k), k=0..n) end:
seq(Pcoeffs(n, a), n = 0..9);
# Alternatively, term by term:
T := proc(n, k, a) option remember; # Alois P. Heinz style
`if`(k=0, `if`(n=0, 1, 0), `if`(k=1, `if`(n=0, 0, a(n)),
(q->add(T(j, q, a)*T(n-j, k-q, a), j=0..n))(iquo(k, 2)))) end:
seq(seq(T(n, k, a), k=0..n), n=0..9);
MATHEMATICA
PMatrix[dim_, a_] := Module[{n, k, m, g, M, A}, If[n == 0, Return[1]]; A = Array[a, dim-1]; M = Array[0&, {dim, dim}]; M[[1, 1]] = 1; For[m = 2, m <= dim, m++, M[[m, m]] = M[[m-1, m-1]]*A[[1]]; For[k = m-1, k >= 2, k--, M[[m, k]] = Sum[A[[i]]*M[[m-i, k-1]], {i, 1, m-k+1}]]]; M];
a[n_] := If[PrimeQ[n], n, 1];
nmax = 10;
PM = PMatrix[nmax+1, a];
T[n_, k_] := PM[[n+1, k+1]];
Table[T[n, k], {n, 0, nmax}, {k, 0, n}] // Flatten (* Jean-François Alcover, Oct 21 2022 *)
PROG
(Python)
def ConvTriangle(dim: int, a) -> list[list[int]]:
if callable(a): # Cache the input sequence.
A = [a(i) for i in range(1, dim)]
else:
A = a
print("In:", A)
C = [[0 for k in range(m + 1)] for m in range(dim)]
C[0][0] = 1
for m in range(1, dim):
C[m][m] = C[m - 1][m - 1] * A[0]
for k in range(m - 1, 0, -1):
C[m][k] = sum(A[i] * C[m - i - 1][k - 1] for i in range(m - k + 1))
return C
from sympy import isprime, flatten
def a(n): return n if isprime(n) else 1
print(flatten(ConvTriangle(10, a)))
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Peter Luschny, Oct 03 2022
STATUS
approved