login
Elements in 3-Pascal triangle (by row).
22

%I #32 Apr 28 2021 04:25:18

%S 1,1,1,1,3,1,1,4,4,1,1,5,8,5,1,1,6,13,13,6,1,1,7,19,26,19,7,1,1,8,26,

%T 45,45,26,8,1,1,9,34,71,90,71,34,9,1,1,10,43,105,161,161,105,43,10,1,

%U 1,11,53,148,266,322,266,148,53,11,1,1,12,64,201,414,588,588,414,201,64,12,1

%N Elements in 3-Pascal triangle (by row).

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

%H László Németh, <a href="http://math.colgate.edu/~integers/t41/t41.Abstract.html">Tetrahedron trinomial coefficient transform</a>, Integers (2019) Vol. 19, Article A41.

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

%F After the 3rd row, use Pascal's rule.

%F From _Ralf Stephan_, Jan 31 2005: (Start)

%F T(n, k) = C(n, k) + C(n-2, k-1).

%F G.f.: (1 + x^2*y)/(1 - x*(1+y)). (End)

%F T(n+2,k+1) = A007318(n,k) - A007318(n+2,k+1); 0 < k < n. - _Reinhard Zumkeller_, Aug 02 2012

%F Sum_{k=0..n} T(n,k) = (n+1)*[n<2] + 5*2^(n-2)*[n>=2]. - _G. C. Greubel_, Apr 28 2021

%e Triangle begins:

%e 1;

%e 1 1;

%e 1 3 1;

%e 1 4 4 1;

%e 1 5 8 5 1;

%e ...

%t T[n_, k_]:= If[n==1, 1, Binomial[n, k] + Binomial[n-2, k-1]]; Table[T[n, k], {n, 0, 11}, {k, 0, n}]//Flatten (* _Jean-François Alcover_, Jan 28 2015 *)

%o (Haskell)

%o a028262 n k = a028262_tabl !! n !! k

%o a028262_row n = a028262_tabl !! n

%o a028262_tabl = [1] : [1,1] : iterate

%o (\row -> zipWith (+) ([0] ++ row) (row ++ [0])) [1,3,1]

%o -- _Reinhard Zumkeller_, Aug 02 2012

%o (Magma)

%o T:= func< n,k | n lt 2 select 1 else Binomial(n, k) + Binomial(n-2, k-1) >;

%o [T(n,k): k in [0..n], n in [0..12]]; # _G. C. Greubel_, Apr 28 2021

%o (Sage)

%o def T(n,k): return 1 if n<2 else binomial(n,k) + binomial(n-2,k-1)

%o flatten([[T(n,k) for k in (0..n)] for n in (0..12)]) # _G. C. Greubel_, Apr 28 2021

%Y Cf. A007318, A028275, A072405.

%K nonn,nice,tabl

%O 0,5

%A _Mohammad K. Azarian_

%E More terms from _James A. Sellers_