|
|
A228576
|
|
A triangle formed like generalized Pascal's triangle. The rule is T(n,k) = 2*T(n-1,k-1) + T(n-1,k), the left border is n and the right border is n^2 instead of 1.
|
|
19
|
|
|
0, 1, 1, 2, 3, 4, 3, 7, 10, 9, 4, 13, 24, 29, 16, 5, 21, 50, 77, 74, 25, 6, 31, 92, 177, 228, 173, 36, 7, 43, 154, 361, 582, 629, 382, 49, 8, 57, 240, 669, 1304, 1793, 1640, 813, 64, 9, 73, 354, 1149, 2642, 4401, 5226, 4093, 1690, 81, 10, 91, 500, 1857, 4940, 9685, 14028, 14545, 9876, 3461, 100
(list;
table;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,4
|
|
LINKS
|
|
|
FORMULA
|
T(n, k) = 2*T(n-1, k-1) + T(n-1, k) for n,k >=0, with T(n,0) = n, T(n,n) = n^2.
Closed-form formula for generalized Pascal's triangle. Let a,b be any numbers. The rule is T(n, k) = a*T(n-1, k-1) + b*T(n-1, k) for n,k >0. Let L(m) and R(m) be the left border and the right border generalized Pascal's triangle, respectively.
As table read by antidiagonals T(n,k) = Sum_{m1=1..n} a^(n-m1) * b^k*R(m1)*C(n+k-m1-1,n-m1) + Sum_{m2=1..k} a^n*b^(k-m2)*L(m2)*C(n+k-m2-1,k-m2); n,k >=0.
As linear sequence a(n) = Sum_{m1=1..i} a^(i-m1)*b^j*R(m1)*C(i+j-m1-1,i-m1) + Sum_{m2=1..j} a^i*b^(j-m2)*L(m2)*C(i+j-m2-1,j-m2), where i=n-t*(t+1)/2-1, j=(t*t+3*t+4)/2-n-1, t=floor((-1+sqrt(8*n-7))/2); n>0.
Some special cases. If a=b=1, then the closed-form formula for arbitrary left and right borders of Pascal like triangle see A228196.
If a=0, then as table read by antidiagonals T(n,k)=b*R(n), as linear sequence a(n)=b*R(i), where i=n-t*(t+1)/2-1, t=floor((-1+sqrt(8*n-7))/2); n>0. The sequence a(n) is the reluctant sequence of sequence b*R(n) - a(n) is triangle array read by rows: row number k coincides with first k elements of the sequence b*R(n). Similarly for b=0, we get T(n,k)=a*L(k).
For this sequence L(m)=m and R(m)=m^2, a=2, b=1. As table read by antidiagonals T(n,k) = Sum_{m1=1..n} 2^(n-m1)*m1^2*C(n+k-m1-1,n-m1) + Sum_{m2=1..k} 2^n*m2*C(n+k-m2-1,k-m2); n,k >=0.
As linear sequence a(n) = Sum_{m1=1..i} 2^(i-m1)*m1^2*C(i+j-m1-1, i-m1) + Sum_{m2=1..j} 2^i*m2*C(i+j-m2-1,j-m2), where i=n-t*(t+1)/2-1, j=(t*t+3*t+4)/2-n-1, t=floor((-1+sqrt(8*n-7))/2); n>0.
|
|
EXAMPLE
|
The start of the sequence as triangle array read by rows:
0;
1, 1;
2, 3, 4;
3, 7, 10, 9;
4, 13, 24, 29, 16;
5, 21, 50, 77, 74, 25;
...
|
|
MAPLE
|
T := proc(n, k) option remember;
if k = 0 then RETURN(n) fi;
if k = n then RETURN(n^2) fi;
2*T(n-1, k-1) + T(n-1, k) end:
|
|
MATHEMATICA
|
T[n_, 0]:= n; T[n_, n_]:= n^2; T[n_, k_]:= T[n, k] = 2*T[n-1, k-1]+T[n-1, k]; Table[T[n, k], {n, 0, 10}, {k, 0, n}] // Flatten (* Jean-François Alcover, Feb 25 2014 *)
|
|
PROG
|
(PARI) T(n, k) = if(k==0, n, if(k==n, n^2, 2*T(n-1, k-1) + T(n-1, k) )); \\ G. C. Greubel, Nov 13 2019
(Magma)
function T(n, k)
if k eq 0 then return n;
elif k eq n then return n^2;
else return 2*T(n-1, k-1) + T(n-1, k);
end if;
return T;
end function;
[T(n, k): k in [0..n], n in [0..12]]; // G. C. Greubel, Nov 13 2019
(Sage)
@CachedFunction
def T(n, k):
if (k==0): return n
elif (k==n): return n^2
else: return 2*T(n-1, k-1) + T(n-1, k)
[[T(n, k) for k in (0..n)] for n in (0..12)] # G. C. Greubel, Nov 13 2019
(GAP)
T:= function(n, k)
if k=0 then return n;
elif k=n then return n^2;
else return 2*T(n-1, k-1) + T(n-1, k);
fi;
end;
Flat(List([0..12], n-> List([0..n], k-> T(n, k) ))); # G. C. Greubel, Nov 13 2019
|
|
CROSSREFS
|
Cf. We denote generalized Pascal's like triangle with coefficients a, b and with L(n) on the left border and R(n) on the right border by (a,b,L(n),R(n)). The list of sequences for (1,1,L(n),R(n)) see A228196;
A038207 (1,2,2^n,1), A105728 (1, 2, 1, n+1), A112468 (1,-1,1,1), A112626 (1,2,3^n,1), A119258 (2,1,1,1), A119673 (3,1,1,1), A119725 (3,2,1,1), A119726 (4,2,1,1), A119727 (5,2,1,1), A209705 (2,1,n+1,0);
A002061 (column 2), A000244 (sums of rows r of triangle array - (r-2)(r+1)/2).
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|