login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A055794 Triangle T read by rows: T(i,0)=1 for i >= 0; T(i,i)=0 for i=0,1,2,3; T(i,i)=0 for i >= 4; T(i,j) = T(i-1,j) + T(i-2,j-1) for 1<=j<=i-1. 6
1, 1, 1, 1, 2, 1, 1, 3, 2, 1, 1, 4, 4, 2, 0, 1, 5, 7, 4, 1, 0, 1, 6, 11, 8, 3, 0, 0, 1, 7, 16, 15, 7, 1, 0, 0, 1, 8, 22, 26, 15, 4, 0, 0, 0, 1, 9, 29, 42, 30, 11, 1, 0, 0, 0, 1, 10, 37, 64, 56, 26, 5, 0, 0, 0, 0, 1, 11, 46, 93, 98, 56, 16, 1, 0, 0, 0, 0, 1, 12, 56, 130, 162, 112, 42, 6, 0, 0, 0, 0, 0 (list; table; graph; refs; listen; history; text; internal format)
OFFSET

0,5

COMMENTS

T(i+j,j) is the number of strings (s(1),...,s(i+1)) of nonnegative integers s(k) such that 0<=s(k)-s(k-1)<=1 for k=2,3,...,i+1 and s(i+1)=j.

T(i+j,j) is the number of compositions of j consisting of i parts, all of in {0,1}.

LINKS

G. C. Greubel, Rows n = 0..100 of triangle, flattened

C. Kimberling, Path-counting and Fibonacci numbers, Fib. Quart. 40 (4) (2002) 328-338, Example 1B.

EXAMPLE

Triangle begins:

  1;

  1, 1;

  1, 2, 1;

  1, 3, 2, 1;

  1, 4, 4, 2, 0;

  1, 5, 7, 4, 1, 0;

  ...

T(7,4) counts the strings 3334, 3344, 3444, 2234, 2334, 2344, 1234.

T(7,4) counts the compositions 001, 010, 100, 011, 101, 110, 111.

MAPLE

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

      if k=0 then 1

    elif k=n and n<4 then 1

    elif k=n then 0

    else T(n-1, k) + T(n-2, k-1)

      fi; end:

seq(seq(T(n, k), k=0..n), n=0..12); # G. C. Greubel, Jan 25 2020

MATHEMATICA

T[n_, k_]:= T[n, k]= If[k==0, 1, If[k==n && n<4, 1, If[k==n, 0, T[n-1, k] + T[n-2, k-1] ]]]; Table[T[n, k], {n, 0, 12}, {k, 0, n}]//Flatten (* G. C. Greubel, Jan 25 2020 *)

PROG

(PARI) T(n, k) = if(k==0, 1, if(k==n && n<4, 1, if(k==n, 0, T(n-1, k) + T(n-2, k-1) )));

for(n=0, 12, for(k=0, n, print1(T(n, k), ", "))) \\ G. C. Greubel, Jan 25 2020

(MAGMA)

function T(n, k)

  if k eq 0 then return 1;

  elif k eq n and n lt 4 then return 1;

  elif k eq n then return 0;

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

  end if; return T; end function;

[T(n, k): k in [0..n], n in [0..12]]; // G. C. Greubel, Jan 25 2020

(Sage)

@CachedFunction

def T(n, k):

    if (k==0): return 1

    elif (k==n and n<4): return 1

    elif (k==n): return 0

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

[[T(n, k) for k in (0..n)] for n in (0..12)] # G. C. Greubel, Jan 25 2020

(GAP)

T:= function(n, k)

    if k=0 then return 1;

    elif k=n and n<4 then return 1;

    elif k=n then return 0;

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

    fi; end;

Flat(List([0..12], n-> List([0..n], k-> T(n, k) ))); # G. C. Greubel, Jan 25 2020

CROSSREFS

Row sums: A000032 (Lucas numbers, 1, 2, 4, 7, 11, 18, ...).

T(2n, n)=A000125(n) (Cake numbers, 1, 2, 4, 8, 15, 26, ...).

T(2n+2, n)=A027660(n).

Sequence in context: A278427 A077592 A194005 * A092905 A052509 A172119

Adjacent sequences:  A055791 A055792 A055793 * A055795 A055796 A055797

KEYWORD

nonn,tabl

AUTHOR

Clark Kimberling, May 28 2000

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 27 15:49 EST 2020. Contains 332307 sequences. (Running on oeis4.)