%I #40 Jan 06 2023 13:46:59
%S 1,1,1,1,1,1,1,2,2,2,1,3,5,6,4,1,4,9,14,15,10,1,5,14,27,38,39,25,1,6,
%T 20,46,79,104,102,64,1,7,27,72,145,229,285,270,166,1,8,35,106,244,446,
%U 659,784,721,436,1,9,44,149,385,796,1349,1889,2164,1941,1157,1,10,54,202,578,1330,2530,4034,5402,5994,5262,3098
%N Triangle, T(n, k): T(n,k) = 1 for n < 3, T(3,1) = T(3,2) = T(3,3) = 2, T(n,0) = 1, T(n,1) = n-1, T(n,n) = T(n-1,n-2) + T(n-1,n-1), otherwise T(n,k) = T(n-1,k-2) + T(n-1,k-1) + T(n-1,k), read by rows.
%C a(n) = number of strings s(0)..s(n) such that s(n) = n-k, where s(0) = 0, s(1) = 1, |s(i)-s(i-1)| <= 1 for i >= 2; |s(2)-s(1)| = 1, and |s(3)-s(2)| = 1 if s(2) = 1.
%H Clark Kimberling, <a href="/A026268/b026268.txt">Rows 0..100, flattened</a>
%H <a href="/index/Pas#Pascal">Index entries for triangles and arrays related to Pascal's triangle</a>
%F From _G. C. Greubel_, Sep 24 2022: (Start)
%F T(n, 1) = A000027(n-1), n >= 1.
%F T(n, 2) = A212342(n-1), n >= 2.
%F T(n, n-1) = A026270(n), n >= 2.
%F T(n, n-2) = A026288(n), n >= 2.
%F T(n, n-3) = A026289(n), n >= 3.
%F T(n, n-4) = A026290(n), n >= 4.
%F T(n, n) = A026269(n), n >= 2.
%F T(n, floor(n/2)) = A026297(n), n >= 0.
%F T(2*n, n) = A026292(n).
%F T(2*n, n-1) = A026295(n), n >= 1.
%F T(2*n, n+1) = A026296(n), n >= 1.
%F T(2*n-1, n-1) = A026291(n), n >= 2.
%F T(3*n, n) = A026293(n), n >= 0.
%F T(4*n, n) = A026294(n), n >= 0.
%F Sum_{k=0..n} T(n, k) = A026299(n-1), n >= 3.(End)
%e Triangle begins as:
%e 1;
%e 1, 1;
%e 1, 1, 1;
%e 1, 2, 2, 2;
%e 1, 3, 5, 6, 4;
%e 1, 4, 9, 14, 15, 10;
%e 1, 5, 14, 27, 38, 39, 25;
%e 1, 6, 20, 46, 79, 104, 102, 64;
%e 1, 7, 27, 72, 145, 229, 285, 270, 166;
%e 1, 8, 35, 106, 244, 446, 659, 784, 721, 436;
%e 1, 9, 44, 149, 385, 796, 1349, 1889, 2164, 1941, 1157;
%t T[n_, k_]:= T[n, k]= If[n<3 || k==0, 1, If[k==1, n-1, If[k==2, (n^2-n-2)/2 + Boole[n==2], If[k==n, T[n-1, n-2] +T[n-1, n-1], T[n-1, k-2] + T[n-1, k-1] + T[n -1, k] ]]]];
%t Table[T[n, k], {n,0,14}, {k,0,n}]//Flatten (* corrected by _G. C. Greubel_, Sep 24 2022 *)
%o (Magma)
%o f:= func< n | n eq 2 select 1 else (n^2 -n -2)/2 >;
%o function T(n,k) // T = A026268
%o if k eq 0 or n lt 3 then return 1;
%o elif k eq 1 then return n-1;
%o elif k eq 2 then return f(n);
%o elif k eq n then return T(n-1, n-2) + T(n-1, n-1);
%o else return T(n-1, k-2) + T(n-1, k-1) + T(n-1, k);
%o end if; return T;
%o end function;
%o [T(n,k): k in [0..n], n in [0..14]]; // _G. C. Greubel_, Sep 24 2022
%o (SageMath)
%o def T(n,k): # T = A026268
%o if n<3 or k==0: return 1
%o elif k==1: return n-1
%o elif k==2: return (n^2 -n -2)//2 + int(n==2)
%o elif k==n: return T(n-1, n-2) + T(n-1, n-1)
%o else: return T(n-1, k-2) + T(n-1, k-1) + T(n-1, k)
%o flatten([[T(n,k) for k in range(n+1)] for n in range(14)]) # _G. C. Greubel_, Sep 24 2022
%Y Cf. A026269, A026270, A026288, A026289, A026290, A026291, A026292, A026293.
%Y Cf. A026294, A026295, A026296, A026297, A026299, A026519, A026536, A026552.
%Y Cf. A026584, A027926, A212342.
%K nonn,tabl
%O 0,8
%A _Clark Kimberling_
%E Updated by _Clark Kimberling_, Aug 29 2014
%E Indices of b-file corrected by _Sidney Cadot_, Jan 06 2023.