login
Triangle read by rows: T(n,0) = 1, T(n,n) = floor((n+3)/2) and T(n,k) = T(n-1,k-1) + T(n-1,k), 0 < k < n.
10

%I #16 Oct 12 2021 08:01:40

%S 1,1,2,1,3,2,1,4,5,3,1,5,9,8,3,1,6,14,17,11,4,1,7,20,31,28,15,4,1,8,

%T 27,51,59,43,19,5,1,9,35,78,110,102,62,24,5,1,10,44,113,188,212,164,

%U 86,29,6,1,11,54,157,301,400,376,250,115,35,6,1,12,65,211,458,701,776,626,365,150,41,7

%N Triangle read by rows: T(n,0) = 1, T(n,n) = floor((n+3)/2) and T(n,k) = T(n-1,k-1) + T(n-1,k), 0 < k < n.

%C Another variant of Pascal's triangle;

%C row sums: A081254; central terms: T(2*n,n) = A128082(n+1);

%C T(n,0) = 1;

%C T(n,1) = n + 1 for n > 0;

%C T(n,2) = A000096(n-1) for n > 1;

%C T(n,3) = A105163(n-2) for n > 2;

%C T(n,n-2) = A005744(n-1) for n > 1;

%C T(n,n-1) = A024206(n) for n > 0;

%C T(n,n) = A008619(n+1).

%H Reinhard Zumkeller, <a href="/A181971/b181971.txt">Rows n=0..150 of triangle, flattened</a>

%H <a href="/index/Pas#Pascal">Index entries for triangles and arrays related to Pascal's triangle</a>

%e The triangle begins:

%e . 0: 1

%e . 1: 1 2

%e . 2: 1 3 2

%e . 3: 1 4 5 3

%e . 4: 1 5 9 8 3

%e . 5: 1 6 14 17 11 4

%e . 6: 1 7 20 31 28 15 4

%e . 7: 1 8 27 51 59 43 19 5

%e . 8: 1 9 35 78 110 102 62 24 5

%e . 9: 1 10 44 113 188 212 164 86 29 6.

%t T[n_ /; n >= 0, k_ /; k >= 0] := T[n, k] = If[n == k, Quotient[n + 3, 2], If[k == 0, 1, If[n > k, T[n - 1, k - 1] + T[n - 1, k]]]];

%t Table[T[n, k], {n, 0, 11}, {k, 0, n}] // Flatten (* _Jean-François Alcover_, Oct 12 2021 *)

%o (Haskell)

%o a181971 n k = a181971_tabl !! n !! k

%o a181971_row n = a181971_tabl !! n

%o a181971_tabl = map snd $ iterate f (1, [1]) where

%o f (i, row) = (1 - i, zipWith (+) ([0] ++ row) (row ++ [i]))

%o (PARI) {T(n,k)=if(n==k,(n+3)\2,if(k==0,1,if(n>k,T(n-1,k-1)+T(n-1,k))))}

%o for(n=0,12,for(k=0,n,print1(T(n,k),","));print("")) \\ _Paul D. Hanna_, Jul 18 2012

%Y Cf. A035317, A007318, A074909.

%K nonn,tabl

%O 0,3

%A _Reinhard Zumkeller_, Jul 09 2012