login
A368045
Triangle read by rows. T(n, k) = (k*(k + 1)*(2*k + 1) + n*(n + 1)*(2*n + 1)) / 6.
2
0, 1, 2, 5, 6, 10, 14, 15, 19, 28, 30, 31, 35, 44, 60, 55, 56, 60, 69, 85, 110, 91, 92, 96, 105, 121, 146, 182, 140, 141, 145, 154, 170, 195, 231, 280, 204, 205, 209, 218, 234, 259, 295, 344, 408, 285, 286, 290, 299, 315, 340, 376, 425, 489, 570
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).
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.
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.
FORMULA
T(n, k) = A000330(k) + A000330(n).
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
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).
Cf. A051162 (transform of n^0), A367964 (transform of n^1), this sequence (transform of n^2).
Sequence in context: A086719 A115200 A075823 * A191748 A102212 A191124
KEYWORD
nonn,tabl
AUTHOR
Peter Luschny, Dec 09 2023
STATUS
approved