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!)
A224791 Triangle T(n,k) read by rows: left edge is 0, 1, 2, ... (cf. A001477); otherwise each entry is sum of entry to left and entries immediately above it to left and right, with 1 for the missing right term at right edge. 2
0, 1, 2, 2, 5, 8, 3, 10, 23, 32, 4, 17, 50, 105, 138, 5, 26, 93, 248, 491, 630, 6, 37, 156, 497, 1236, 2357, 2988, 7, 50, 243, 896, 2629, 6222, 11567, 14556, 8, 65, 358, 1497, 5022, 13873, 31662, 57785, 72342, 9, 82, 505, 2360, 8879, 27774, 73309, 162756 (list; table; graph; refs; listen; history; text; internal format)
OFFSET

0,3

LINKS

Reinhard Zumkeller, Rows n = 0..120 of triangle, flattened

Index entries for triangles and arrays related to Pascal's triangle

FORMULA

T(n,0) = n, T(n+1,k) = T(n+1,k-1) + T(n,k-1) + T(n,k) (0 < k <= n) and T(n+1,n+1) = T(n+1,n) + T(n,n) + 1.

EXAMPLE

Triangle begins:

  0;

  1,  2;

  2,  5,  8;

  3, 10, 23,  32;

  4, 17, 50, 105, 138;

MAPLE

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

      if k=0 then n

    elif k=n then T(n, n-1) + T(n-1, n-1) + 1

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

      fi

    end:

seq(seq(T(n, k), k=0..n), n=0..12); # G. C. Greubel, Nov 12 2019

MATHEMATICA

T[n_, k_]:= T[n, k]= If[k==0, n, If[k==n , T[n, n-1] + T[n-1, n-1] + 1, T[n, k-1] + T[n-1, k-1] + T[n-1, k]]]; Table[T[n, k], {n, 0, 12}, {k, 0, n}]//Flatten (* G. C. Greubel, Nov 12 2019 *)

PROG

(Haskell)

a224791 n k = a224791_tabl !! n !! k

a224791_row n = a224791_tabl !! n

a224791_tabl = iterate

   (\row -> scanl1 (+) $ zipWith (+) ([1] ++ row) (row ++ [1])) [0]

(PARI) T(n, k) = if(k==0, n, if(k==n, T(n, n-1) + T(n-1, n-1) + 1, T(n, k-1) + T(n-1, k-1) + T(n-1, k) )); \\ G. C. Greubel, Nov 12 2019

(Sage)

@CachedFunction

def T(n, k):

    if (k==0): return n

    elif (k==n): return T(n, n-1) + T(n-1, n-1) + 1

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

[[T(n, k) for k in (0..n)] for n in (0..12)] # G. C. Greubel, Nov 12 2019

CROSSREFS

Cf. A051601, A059283.

Sequence in context: A077232 A193891 A193906 * A210637 A201972 A202396

Adjacent sequences:  A224788 A224789 A224790 * A224792 A224793 A224794

KEYWORD

nonn,tabl

AUTHOR

Reinhard Zumkeller, Apr 18 2013

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 July 4 22:15 EDT 2020. Contains 335449 sequences. (Running on oeis4.)