File pascltri.icn

Summary

###########################################################################

       File:     pascltri.icn

       Subject:  Procedure to compute a row of Pascal's Triangle

       Author:   Erik Eid

       Date:     August 7, 1997

###########################################################################

   This file is in the public domain.

###########################################################################

     The procedure, when invoked by a call to PascalsTriangle(n), returns
 the nth row of Pascal's Triangle in list form.  Pascal's Triangle is a
 mathematical structure in which each element of a row is the sum of the
 two elements directly above it.  The first few levels are:
 
    Row 1:          1           Triangle stored as: [[1],
        2:        1   1                              [1, 1],
        3:      1   2   1                            [1, 2, 1],
        4:    1   3   3   1                          [1, 3, 3, 1],
        5:  1   4   6   4   1                        [1, 4, 6, 4, 1]]

 For example, PascalsTriangle(4) would return the list [1, 3, 3, 1].

     The procedure fails if n is not an integer or if it is less than one.

###########################################################################
Procedures:
PascalsTriangle

This file is part of the (main) package.

Source code.

Details
Procedures:

PascalsTriangle(level)

: Pascal triangle row



This page produced by UniDoc on 2021/04/15 @ 23:59:54.