%I #24 Jan 30 2023 03:32:36
%S 1,0,1,0,2,1,0,3,4,1,0,1,10,6,1,0,5,14,21,8,1,0,1,23,47,36,10,1,0,7,
%T 28,90,108,55,12,1,0,1,49,147,258,205,78,14,1,0,1,46,249,520,595,346,
%U 105,16,1,0,1,75,360,978,1437,1185,539,136,18,1
%N Triangle read by rows. Convolution triangle of the prime indicator sequence A089026.
%C 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.
%C 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.
%C 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.
%H Donald E. Knuth, <a href="https://arxiv.org/abs/math/9207221">Convolution polynomials</a>, arXiv:math/9207221 [math.CA]; Mathematica J. 2.1 (1992), no. 4, 67-78.
%H Peter Luschny, <a href="http://oeis.org/wiki/User:Peter_Luschny/P-Transform">The P-transform</a>.
%H Cormac O'Sullivan, <a href="https://arxiv.org/abs/2203.02868">De Moivre and Bell polynomials</a>, arXiv:2203.02868 [math.CO], 2022.
%e Triangle T(n, k) starts:
%e [0] 1;
%e [1] 0, 1;
%e [2] 0, 2, 1;
%e [3] 0, 3, 4, 1;
%e [4] 0, 1, 10, 6, 1;
%e [5] 0, 5, 14, 21, 8, 1;
%e [6] 0, 1, 23, 47, 36, 10, 1;
%e [7] 0, 7, 28, 90, 108, 55, 12, 1;
%e [8] 0, 1, 49, 147, 258, 205, 78, 14, 1;
%e [9] 0, 1, 46, 249, 520, 595, 346, 105, 16, 1;
%p PMatrix := proc(dim, a) local n, k, m, g, M, A;
%p if n = 0 then return [1] fi;
%p A := [seq(a(i), i = 1..dim-1)];
%p M := Matrix(dim, shape=triangular[lower]); M[1, 1] := 1;
%p for m from 2 to dim do
%p M[m, m] := M[m - 1, m - 1] * A[1];
%p for k from m-1 by -1 to 2 do
%p M[m, k] := add(A[i]*M[m-i, k-1], i = 1..m-k+1)
%p od od; M end:
%p a := n -> if isprime(n) then n else 1 fi: PMatrix(10, a);
%p # Alternatively, as the coefficients of row polynomials:
%p P := proc(n, x, a) option remember; ifelse(n = 0, 1,
%p x*add(a(n - k)*P(k, x, a), k = 0..n-1)) end:
%p Pcoeffs := proc(n, a) seq(coeff(P(n, x, a), x, k), k=0..n) end:
%p seq(Pcoeffs(n, a), n = 0..9);
%p # Alternatively, term by term:
%p T := proc(n, k, a) option remember; # _Alois P. Heinz_ style
%p `if`(k=0, `if`(n=0, 1, 0), `if`(k=1, `if`(n=0, 0, a(n)),
%p (q->add(T(j, q, a)*T(n-j, k-q, a), j=0..n))(iquo(k, 2)))) end:
%p seq(seq(T(n, k, a), k=0..n), n=0..9);
%t 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];
%t a[n_] := If[PrimeQ[n], n, 1];
%t nmax = 10;
%t PM = PMatrix[nmax+1, a];
%t T[n_, k_] := PM[[n+1, k+1]];
%t Table[T[n, k], {n, 0, nmax}, {k, 0, n}] // Flatten (* _Jean-François Alcover_, Oct 21 2022 *)
%o (Python)
%o def ConvTriangle(dim: int, a) -> list[list[int]]:
%o if callable(a): # Cache the input sequence.
%o A = [a(i) for i in range(1, dim)]
%o else:
%o A = a
%o print("In:", A)
%o C = [[0 for k in range(m + 1)] for m in range(dim)]
%o C[0][0] = 1
%o for m in range(1, dim):
%o C[m][m] = C[m - 1][m - 1] * A[0]
%o for k in range(m - 1, 0, -1):
%o C[m][k] = sum(A[i] * C[m - i - 1][k - 1] for i in range(m - k + 1))
%o return C
%o from sympy import isprime, flatten
%o def a(n): return n if isprime(n) else 1
%o print(flatten(ConvTriangle(10, a)))
%Y Cf. A089026, A340991, A357588.
%K nonn,tabl
%O 0,5
%A _Peter Luschny_, Oct 03 2022