login
Triangular array T read by rows: T(n,0) = T(n,2n) = 1 for n >= 0, T(n,1)=0 for n >= 1, T(n,2)=1 for n >= 2 and for n >= 3, T(n,k) = T(n-1,k-3) + T(n-1, k-2) + T(n-1,k-1) for 3 <= k <= 2n-1. T(n,k)=0 for k < 0 or k > 2n.
40

%I #30 Nov 06 2019 04:26:21

%S 1,1,0,1,1,0,1,2,1,1,0,1,2,3,4,1,1,0,1,2,3,6,9,8,1,1,0,1,2,3,6,11,18,

%T 23,18,1,1,0,1,2,3,6,11,20,35,52,59,42,1,1,0,1,2,3,6,11,20,37,66,107,

%U 146,153,102,1,1,0,1,2,3,6,11,20,37,68,123,210,319,406,401,256,1

%N Triangular array T read by rows: T(n,0) = T(n,2n) = 1 for n >= 0, T(n,1)=0 for n >= 1, T(n,2)=1 for n >= 2 and for n >= 3, T(n,k) = T(n-1,k-3) + T(n-1, k-2) + T(n-1,k-1) for 3 <= k <= 2n-1. T(n,k)=0 for k < 0 or k > 2n.

%C The following sequences all have the same parity: A004737, A006590, A027052, A071028, A071797, A078358, A078446. - _Jeremy Gardiner_, Mar 16 2003

%H G. C. Greubel, <a href="/A027052/b027052.txt">Rows n = 0..50 of triangle, flattened</a>

%F A001590(k+1) = T(n,k) if 0 <= k <= n. - _Michael Somos_, Jun 01 2014

%e Triangle T(n,k) for 0 <= k <= 2n:

%e 1;

%e 1, 0, 1;

%e 1, 0, 1, 2, 1;

%e 1, 0, 1, 2, 3, 4, 1;

%e 1, 0, 1, 2, 3, 6, 9, 8, 1;

%p T:= proc(n, k) option remember;

%p if k=0 or k=2 or k=2*n then 1

%p elif k=1 then 0

%p else add(T(n-1, k-j), j=1..3)

%p fi

%p end:

%p seq(seq(T(n, k), k=0..2*n), n=0..10); # _G. C. Greubel_, Nov 05 2019

%t T[n_, k_]:= T[n, k]= If[k==0 || k==2 || k==2*n, 1, If[k==1, 0, Sum[T[n-1, k-j], {j, 3}]]]; Table[T[n, k], {n, 0, 12}, {k, 0, 2*n}]//Flatten (* _G. C. Greubel_, Nov 05 2019 *)

%o (PARI) {T(n, k) = if(k==0 || k==2 || k==2*n, 1, if(k==1, 0, sum(j=1,3, T(n-1, k-j)) ))};

%o for(n=0, 10, for(k=0,2*n, print1(T(n,k), ", "))) \\ _G. C. Greubel_, Nov 05 2019

%o (Sage)

%o @CachedFunction

%o def T(n, k):

%o if (k==0 or k==2 or k==2*n): return 1

%o elif (k==1): return 0

%o else: return sum(T(n-1, k-j) for j in (1..3))

%o [[T(n, k) for k in (0..2*n)] for n in (0..10)] # _G. C. Greubel_, Nov 05 2019

%o (GAP)

%o T:= function(n,k)

%o if k=0 or k=2 or k=2*n then return 1;

%o elif k=1 then return 0;

%o else return Sum([1..3], j-> T(n-1, k-j) );

%o fi;

%o end;

%o Flat(List([0..10], n-> List([0..2*n], k-> T(n,k) ))); # _G. C. Greubel_, Nov 05 2019

%Y Cf. A001590, a tribonacci sequence.

%Y Cf. A160999 (row sums), A005408 (row lengths).

%Y Diagonals T(n, n+c): A027053 (c=2), A027054 (c=3), A027055 (c=4).

%Y Diagonals T(n, 2n-c): A027056 (c=1), A027058 (c=2), A027059 (c=3), A027060 (c=4), A027061(c=5), A027062 (c=6), A027063 (c=7), A027064 (c=8), A027065 (c=9), A027066 (c=10).

%Y Sums involving this array: A027067, A027068, A027069, A027070, A027072, A027073, A027074, A027075, A027076, A027077,A027078, A027079, A027080, A027081.

%Y Other related sequences: A027057, A027071.

%Y Other arrays of this type: A027023, A027082, A027113.

%K nonn,tabf

%O 0,8

%A _Clark Kimberling_

%E Offset and keyword:tabl corrected by _R. J. Mathar_, Jun 01 2009