login
Triangle formed by Pascal's rule, except that the n-th row begins and ends with the n-th Fibonacci number.
18

%I #23 Sep 14 2021 03:52:59

%S 1,1,1,2,2,2,3,4,4,3,5,7,8,7,5,8,12,15,15,12,8,13,20,27,30,27,20,13,

%T 21,33,47,57,57,47,33,21,34,54,80,104,114,104,80,54,34,55,88,134,184,

%U 218,218,184,134,88,55,89,143,222,318,402,436,402,318,222

%N Triangle formed by Pascal's rule, except that the n-th row begins and ends with the n-th Fibonacci number.

%H Reinhard Zumkeller, <a href="/A074829/b074829.txt">Rows n = 1..120 of table, flattened</a>

%H <a href="/index/Pas#Pascal">Index entries for triangles and arrays related to Pascal's triangle</a>

%e The first and second Fibonacci numbers are 1, 1, so the first and second rows of the triangle are 1; 1 1; respectively. The third row of the triangle begins and ends with the third Fibonacci number, 2 and the middle term is the sum of the contiguous two terms in the second row, i.e., 1 + 1 = 2, so the third row is 2 2 2.

%e Triangle begins:

%e 1;

%e 1, 1;

%e 2, 2, 2;

%e 3, 4, 4, 3;

%e 5, 7, 8, 7, 5;

%e 8, 12, 15, 15, 12, 8;

%e 13, 20, 27, 30, 27, 20, 13;

%e 21, 33, 47, 57, 57, 47, 33, 21;

%e 34, 54, 80, 104, 114, 104, 80, 54, 34;

%e ...

%e Formatted as a symmetric triangle:

%e 1;

%e 1, 1;

%e 2, 2, 2;

%e 3, 4, 4, 3;

%e 5, 7, 8, 7, 5;

%e 8, 12, 15, 15, 12, 8;

%e 13, 20, 27, 30, 27, 20, 13;

%e 21, 33, 47, 57, 57, 47, 33, 21;

%e 34, 54, 80, 104, 114, 104, 80, 54, 34;

%t T[n_, 1]:= Fibonacci[n]; T[n_, n_]:= Fibonacci[n]; T[n_, k_]:= T[n-1, k-1] + T[n-1, k]; Table[T[n, k], {n, 1, 12}, {k, 1, n}]//Flatten (* _G. C. Greubel_, Jul 12 2019 *)

%o (Haskell)

%o a074829 n k = a074829_tabl !! (n-1) !! (k-1)

%o a074829_row n = a074829_tabl !! (n-1)

%o a074829_tabl = map fst $ iterate

%o (\(u:_, vs) -> (vs, zipWith (+) ([u] ++ vs) (vs ++ [u]))) ([1], [1,1])

%o -- _Reinhard Zumkeller_, Aug 15 2013

%o (PARI) T(n,k) = if(k==1 || k==n, fibonacci(n), T(n-1,k-1) + T(n-1,k));

%o for(n=1,12, for(k=1,n, print1(T(n,k), ", "))) \\ _G. C. Greubel_, Jul 12 2019

%o (Sage)

%o def T(n, k):

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

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

%o [[T(n, k) for k in (1..n)] for n in (1..12)] # _G. C. Greubel_, Jul 12 2019

%o (GAP)

%o T:= function(n,k)

%o if k=1 then return Fibonacci(n);

%o elif k=n then return Fibonacci(n);

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

%o fi;

%o end;

%o Flat(List([1..15], n-> List([1..n], k-> T(n,k) ))); # _G. C. Greubel_, Jul 12 2019

%Y Some other Fibonacci-Pascal triangles: A027926, A036355, A037027, A105809, A108617, A109906, A111006, A114197, A162741, A228074.

%K easy,nonn,tabl

%O 1,4

%A _Joseph L. Pe_, Sep 30 2002

%E More terms from _Philippe Deléham_, Sep 20 2006

%E Data error in 7th row fixed by _Reinhard Zumkeller_, Aug 15 2013