login
Generalized Pascal triangle.
0

%I #17 Jan 14 2015 03:06:40

%S 1,1,3,1,2,4,1,5,5,5,1,4,11,9,6,1,7,14,21,14,7,1,6,22,34,36,20,8,1,9,

%T 27,57,69,57,27,9,1,8,37,83,127,125,85,35,10,1,11,44,121,209,253,209,

%U 121,44,11,1,10,56,164,331,461,463,329,166,54,12

%N Generalized Pascal triangle.

%F T(n, 1)=1, T(n, k)=0 for k>n, T(n, 2) = T(n-1, 1) + T(n-1, 2) + 2*(-1)^n, T(n, k) = T(n-1, k-1) + T(n-1, k) + (-1)^(n+k) for k>2. [corrected by _Frank M Jackson_, Mar 27 2012]

%e First rows are:

%e {1},

%e {1,3},

%e {1,2,4},

%e {1,5,5,5},

%e {1,4,11,9,6},

%e {1,7,14,21,14,7},

%e ...

%e For example, 2 = 1 + 3 - 2, 5 = 1 + 2 + 2; 11 = 5 + 5 + 1, 14 = 4 + 11 - 1.

%t t[n_, k_] := t[n, k]=Which[k==1, 1, n<k, 0, k==2, t[n-1, 1]+t[n-1, 2]+2(-1)^n, k>2, t[n-1, k-1] + t[n-1, k] + (-1)^(n+k)]; Flatten[Table[t[n, k], {n, 1, 20}, {k, 1, n}]] (* _Frank M Jackson_, Mar 27 2012 *)

%Y Columns include A000012, A004442, A000217+(-1)^n, A000292+(-1)^n and in general, binomial(n+k, k)+(-1)^n. Diagonals include A000096, A063258.

%K easy,nonn,tabl

%O 1,3

%A _Paul Barry_, Feb 18 2003

%E Terms corrected and extended by _Frank M Jackson_, Mar 27 2012