cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

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, 21, 33, 47, 57, 57, 47, 33, 21, 34, 54, 80, 104, 114, 104, 80, 54, 34, 55, 88, 134, 184, 218, 218, 184, 134, 88, 55, 89, 143, 222, 318, 402, 436, 402, 318, 222, 143, 89
Offset: 1

Views

Author

Joseph L. Pe, Sep 30 2002

Keywords

Examples

			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.
Triangle begins:
   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;
  21, 33, 47,  57,  57,  47, 33, 21;
  34, 54, 80, 104, 114, 104, 80, 54, 34;
  ...
Formatted as a symmetric triangle:
                           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;
     21,   33,   47,   57,   57,   47,   33,   21;
  34,   54,   80,  104,  114,  104,   80,   54,   34;
		

Crossrefs

Some other Fibonacci-Pascal triangles: A027926, A036355, A037027, A105809, A108617, A109906, A111006, A114197, A162741, A228074.
Cf. A074878 (row sums).

Programs

  • GAP
    T:= function(n,k)
        if k=1 then return Fibonacci(n);
        elif k=n then return Fibonacci(n);
        else return T(n-1,k-1) + T(n-1,k);
        fi;
      end;
    Flat(List([1..15], n-> List([1..n], k-> T(n,k) ))); # G. C. Greubel, Jul 12 2019
  • Haskell
    a074829 n k = a074829_tabl !! (n-1) !! (k-1)
    a074829_row n = a074829_tabl !! (n-1)
    a074829_tabl = map fst $ iterate
       (\(u:_, vs) -> (vs, zipWith (+) ([u] ++ vs) (vs ++ [u]))) ([1], [1,1])
    -- Reinhard Zumkeller, Aug 15 2013
    
  • Maple
    A074829 := proc(n,k)
        option remember ;
        if k=1 or k=n then
            combinat[fibonacci](n) ;
        else
            procname(n-1,k-1)+procname(n-1,k) ;
        end if;
    end proc:
    seq(seq(A074829(n,k),k=1..n),n=1..12) ; # R. J. Mathar, Mar 31 2025
  • Mathematica
    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 *)
  • PARI
    T(n,k) = if(k==1 || k==n, fibonacci(n), T(n-1,k-1) + T(n-1,k));
    for(n=1,12, for(k=1,n, print1(T(n,k), ", "))) \\ G. C. Greubel, Jul 12 2019
    
  • Sage
    def T(n, k):
        if (k==1 or k==n): return fibonacci(n)
        else: return T(n-1, k-1) + T(n-1, k)
    [[T(n, k) for k in (1..n)] for n in (1..12)] # G. C. Greubel, Jul 12 2019
    

Extensions

More terms from Philippe Deléham, Sep 20 2006
Data error in 7th row fixed by Reinhard Zumkeller, Aug 15 2013