Pascal’s Triangle (#111)
Jonathan Frech
Pascal’s triangle is an interesting mathematical sequence. It is often written as a triangle, starting with , then
. To generate the next row, you add the two numbers above to form another one. So the next row in the sequence is
then
,
and so on (sequence A007318 in OEIS).
One interesting property of Pascal’s triangle is the generation of binomials.
To calculate , you can look at the 4-th row (listed above and when starting to count at 0) and determine
This program generates Pascal’s sequence in a rather unusual shape, looking a bit like a crown.
To get more information about Pascal’s triangle, check out this Wikipedia entry.
Controls
- “F1” advances the sequence,
- “Space” takes a screenshot.



Source code: pascals-triangle.py
[1] | In pascals-triangle_pascal.py there is a typo: “sedonds” should say “seconds”. |