%I #18 Dec 10 2023 16:58:10
%S 0,1,2,5,6,10,14,15,19,28,30,31,35,44,60,55,56,60,69,85,110,91,92,96,
%T 105,121,146,182,140,141,145,154,170,195,231,280,204,205,209,218,234,
%U 259,295,344,408,285,286,290,299,315,340,376,425,489,570
%N Triangle read by rows. T(n, k) = (k*(k + 1)*(2*k + 1) + n*(n + 1)*(2*n + 1)) / 6.
%C Consider a sequence-to-triangle transformation a -> T, where a is a 0-based sequence and T a regular (0, 0)-based triangular array. The transformation is recursively defined, starting with T(0, 0) = 0, and T(n, n) = a(n) + T(n, n - 1) for n > 0. For k <> n let T(n, k) = a(n) + T(n-1, k).
%C If a(n) = 1, then T = A051162; if a(n) = n, then T = A367964 (generalizing the triangular numbers); if a(n) = n^2, then T is this triangle.
%C In the multiplicative form of the transformation, T(0, 0) is set to 1, and the operation '+' is replaced by '*'. For instance, a(n) = 2 is then mapped to T = A368043 and a(n) = n to A143216.
%F T(n, k) = A000330(k) + A000330(n).
%e Triangle T(n, k) starts:
%e [0] [ 0]
%e [1] [ 1, 2]
%e [2] [ 5, 6, 10]
%e [3] [ 14, 15, 19, 28]
%e [4] [ 30, 31, 35, 44, 60]
%e [5] [ 55, 56, 60, 69, 85, 110]
%e [6] [ 91, 92, 96, 105, 121, 146, 182]
%e [7] [140, 141, 145, 154, 170, 195, 231, 280]
%e [8] [204, 205, 209, 218, 234, 259, 295, 344, 408]
%e [9] [285, 286, 290, 299, 315, 340, 376, 425, 489, 570]
%t Module[{n=1},NestList[Append[#+n^2,Last[#]+2(n++^2)]&,{0},10]] (* or *)
%t Table[(k(k+1)(2k+1)+n(n+1)(2n+1))/6,{n,0,10},{k,0,n}] (* _Paolo Xausa_, Dec 10 2023 *)
%o (Python)
%o from functools import cache
%o @cache
%o def Trow(n: int) -> list[int]:
%o if n == 0: return [0]
%o row = Trow(n - 1) + [0]
%o for k in range(n): row[k] += n * n
%o row[n] = row[n - 1] + n * n
%o return row
%o print([k for n in range(10) for k in Trow(n)])
%Y Cf. A000330 (T(n,0)), A056520 (T(n,1)), A005900 (T(n-1,n)), A006331 (T(n,n)), A094952 T(2n,n)), A368046 (row sums), A368047 (alternating row sums).
%Y Cf. A051162 (transform of n^0), A367964 (transform of n^1), this sequence (transform of n^2).
%Y Cf. A368043, A143216.
%K nonn,tabl
%O 0,3
%A _Peter Luschny_, Dec 09 2023
|