Function Repository Resource:

PascalsTriangle

Source Notebook

Display a given number of rows in Pascal's triangle

Contributed by: Paco Jain (Wolfram Research)

ResourceFunction["PascalsTriangle"][n]

creates a grid representing the first n rows of Pascal's triangle.

Details and Options

ResourceFunction["PascalsTriangle"][n] returns an n-by-(2n+1) grid whose elements are either integers or the empty string "".

Examples

Basic Examples (2) 

Display the first five rows of Pascal's triangle:

In[1]:=
ResourceFunction["PascalsTriangle"][5]
Out[1]=

Display the first seven rows of Pascal's triangle:

In[2]:=
ResourceFunction["PascalsTriangle"][7]
Out[2]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 06 March 2019

License Information