login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A026758 Triangular array T read by rows: T(n,0)=T(n,n)=1 for n >= 0; for n >= 2 and 1 <= k <= n-1, T(n,k) = T(n-1,k-1) + T(n-2,k-1) + T(n-1,k) if n is odd and 1 <= k <= (n-1)/2, else T(n,k) = T(n-1,k-1) + T(n-1,k). 30

%I #16 Oct 30 2019 01:12:07

%S 1,1,1,1,2,1,1,4,3,1,1,5,7,4,1,1,7,16,11,5,1,1,8,23,27,16,6,1,1,10,38,

%T 66,43,22,7,1,1,11,48,104,109,65,29,8,1,1,13,69,190,279,174,94,37,9,1,

%U 1,14,82,259,469,453,268,131,46,10,1,1,16,109,410,918,1201,721,399,177,56,11,1

%N Triangular array T read by rows: T(n,0)=T(n,n)=1 for n >= 0; for n >= 2 and 1 <= k <= n-1, T(n,k) = T(n-1,k-1) + T(n-2,k-1) + T(n-1,k) if n is odd and 1 <= k <= (n-1)/2, else T(n,k) = T(n-1,k-1) + T(n-1,k).

%H G. C. Greubel, <a href="/A026758/b026758.txt">Rows n = 0..100 of triangle, flattened</a>

%F T(n, k) = number of paths from (0, 0) to (n-k, k) in directed graph having vertices (i, j) and edges (i, j)-to-(i+1, j) and (i, j)-to-(i, j+1) for i, j >= 0 and edges (i, 2h+i+1)-to-(i+1, 2h+i+2) for i >= 0, h>=0.

%e Triangle begins as:

%e 1;

%e 1, 1;

%e 1, 2, 1;

%e 1, 4, 3, 1;

%e 1, 5, 7, 4, 1;

%e 1, 7, 16, 11, 5, 1;

%e 1, 8, 23, 27, 16, 6, 1;

%e 1, 10, 38, 66, 43, 22, 7, 1;

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

%p if k=0 or k = n then 1;

%p elif type(n,'odd') and k <= (n-1)/2 then

%p procname(n-1,k-1)+procname(n-2,k-1)+procname(n-1,k) ;

%p else

%p procname(n-1,k-1)+procname(n-1,k) ;

%p end if ;

%p end proc;

%p seq(seq(T(n,k), k=0..n), n=0..12); # _G. C. Greubel_, Oct 29 2019

%t T[n_, k_]:= T[n, k]= If[k==0 || k==n, 1, If[OddQ[n] && k<=(n-1)/2, T[n-1, k-1] + T[n-2, k-1] + T[n-1, k], T[n-1, k-1] + T[n-1, k] ]]; Table[T[n, k], {n,0,12}, {k,0,n}]//Flatten (* _G. C. Greubel_, Oct 29 2019 *)

%o (PARI) T(n,k) = if(k==0 || k==n, 1, if(n%2==1 && k<=(n-1)/2, T(n-1,k-1) + T(n-2,k-1) + T(n-1,k), T(n-1,k-1) + T(n-1,k) ));

%o for(n=0,12, for(k=0,n, print1(T(n,k), ", "))) \\ _G. C. Greubel_, Oct 29 2019

%o (Sage)

%o @CachedFunction

%o def T(n, k):

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

%o elif (mod(n,2)==1 and k<=(n-1)/2): return T(n-1,k-1) + T(n-2,k-1) + T(n-1,k)

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

%o [[T(n, k) for k in (0..n)] for n in (0..12)] # _G. C. Greubel_, Oct 29 2019

%o (GAP)

%o T:= function(n,k)

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

%o elif (n mod 2)=1 and k<Int(n/2)+1 then return T(n-1,k-1)+T(n-2,k-1) +T(n-1,k);

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

%o fi;

%o end;

%o Flat(List([0..12], n-> List([0..n], k-> T(n,k) ))); # _G. C. Greubel_, Oct 29 2019

%Y Cf. A026765 (row sums).

%K nonn,tabl

%O 0,5

%A _Clark Kimberling_

%E Offset corrected by _Sean A. Irvine_, Oct 25 2019

%E More terms added by _G. C. Greubel_, Oct 29 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 8 18:04 EDT 2024. Contains 372340 sequences. (Running on oeis4.)