login
Tribonacci array: triangular array T read by rows: T(n,0)=1 for n >= 0, T(n,1) = T(n,2n) = 1 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.
30

%I #34 Jun 27 2022 21:18:51

%S 1,1,1,1,1,1,1,3,1,1,1,1,3,5,5,1,1,1,1,3,5,9,13,11,1,1,1,1,3,5,9,17,

%T 27,33,25,1,1,1,1,3,5,9,17,31,53,77,85,59,1,1,1,1,3,5,9,17,31,57,101,

%U 161,215,221,145,1,1,1,1,3,5,9,17,31,57,105,189,319,477,597,581,367,1

%N Tribonacci array: triangular array T read by rows: T(n,0)=1 for n >= 0, T(n,1) = T(n,2n) = 1 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.

%C The n-th row has 2n+1 terms.

%H R. J. Mathar, <a href="/A027023/b027023.txt">Table of n, a(n) for n = 0..1000</a>, replaces Zumkeller's file for new offset.

%e The array begins:

%e 1;

%e 1, 1, 1;

%e 1, 1, 1, 3, 1;

%e 1, 1, 1, 3, 5, 5, 1;

%e 1, 1, 1, 3, 5, 9, 13, 11, 1;

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

%p if k<3 or k=2*n then 1

%p else T(n-1, k-3) + T(n-1, k-2) + T(n-1, k-1)

%p fi

%p end proc:

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

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

%o (PARI) {T(n, k) = if( k<0 || k>2*n, 0, if( k<3 || k==2*n, 1, T(n-1, k-3) + T(n-1, k-2) + T(n-1,k-1)))}; /* _Michael Somos_, Feb 14 2004 */

%o (Haskell)

%o a027023 n k = a027023_tabf !! (n-1) !! (k-1)

%o a027023_row n = a027023_tabf !! (n-1)

%o a027023_tabf = [1] : iterate f [1, 1, 1] where

%o f row = 1 : 1 : 1 :

%o zipWith3 (((+) .) . (+)) (drop 2 row) (tail row) row ++ [1]

%o -- _Reinhard Zumkeller_, Jul 06 2014

%o (Sage)

%o def T(n, k):

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

%o else: return T(n-1, k-3) + T(n-1, k-2) + T(n-1, k-1)

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

%o (GAP)

%o T:= function(n,k)

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

%o else return T(n-1, k-3) + T(n-1, k-2) + T(n-1, k-1);

%o fi;

%o end;

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

%Y Columns are essentially constant with values from A000213 (tribonacci numbers).

%Y Diagonals T(n, n+c) are A027024 (c=2), A027025 (c=3), A027026 (c=4).

%Y Diagonals T(n, 2n-c) are A027050 (c=1), A027051 (c=2), A027027 (c=3), A027028 (c=4), A027029 (c=5), A027030 (c=6), A027031 (c=7), A027032 (c=8), A027033 (c=9), A027034 (c=10).

%Y Many other sequences are derived from this one: see A027035 A027036 A027037 A027038 A027039 A027040 A027041 A027042 A027043 A027044 A027045 and A027046 A027047 A027048 A027049.

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

%Y Cf. A027907.

%K nonn,tabf,nice

%O 0,8

%A _Clark Kimberling_

%E Edited by _N. J. A. Sloane_ and _Ralf Stephan_, Feb 13 2004

%E Offset corrected to 0. - _R. J. Mathar_, Jun 24 2020