OFFSET
0,3
COMMENTS
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).
EXAMPLE
Triangle T(n, k) starts:
[0] [ 0]
[1] [ 1, 2]
[2] [ 5, 6, 10]
[3] [ 14, 15, 19, 28]
[4] [ 30, 31, 35, 44, 60]
[5] [ 55, 56, 60, 69, 85, 110]
[6] [ 91, 92, 96, 105, 121, 146, 182]
[7] [140, 141, 145, 154, 170, 195, 231, 280]
[8] [204, 205, 209, 218, 234, 259, 295, 344, 408]
[9] [285, 286, 290, 299, 315, 340, 376, 425, 489, 570]
MATHEMATICA
Module[{n=1}, NestList[Append[#+n^2, Last[#]+2(n++^2)]&, {0}, 10]] (* or *)
Table[(k(k+1)(2k+1)+n(n+1)(2n+1))/6, {n, 0, 10}, {k, 0, n}] (* Paolo Xausa, Dec 10 2023 *)
PROG
(Python)
from functools import cache
@cache
def Trow(n: int) -> list[int]:
if n == 0: return [0]
row = Trow(n - 1) + [0]
for k in range(n): row[k] += n * n
row[n] = row[n - 1] + n * n
return row
print([k for n in range(10) for k in Trow(n)])
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Peter Luschny, Dec 09 2023
STATUS
approved