![]() |
Python
1.0
|
Pascal triangle using factorials. More...
Functions | |
def | factr (n) |
Factorial of n, recursive version. More... | |
def | fact (n) |
Factorial of n, non-recursive version. More... | |
def | kfact (n, k) |
k factorial of n. More... | |
def | pascal (n, k) |
The binomial coefficient, refered as row n, column k. More... | |
def | showpascal (n) |
Prints successive rows of Pascal's triangle, from 0 to n. More... | |
Pascal triangle using factorials.
0 1 1 1 1 2 1 2 1 3 1 3 3 1 4 1 4 6 4 1 5 1 5 10 10 5 1
0 1 2 3 4 5
def _03d_pascal_rec.fact | ( | n | ) |
Factorial of n, non-recursive version.
The factorial, denoted by n!, is defined for a positive integer, and represents the product of all numbers less than or equal n.
n | an integer. |
def _03d_pascal_rec.factr | ( | n | ) |
Factorial of n, recursive version.
The factorial, denoted by n!, is defined for a positive integer, and represents the product of all numbers less than or equal n.
n | an integer. |
References fact().
def _03d_pascal_rec.kfact | ( | n, | |
k | |||
) |
def _03d_pascal_rec.pascal | ( | n, | |
k | |||
) |
The binomial coefficient, refered as row n, column k.
It also represents the number of combinations of n things taken k at a time (called n choose k).
n | row. |
k | column. |
References fact(), and kfact().
Referenced by showpascal().
def _03d_pascal_rec.showpascal | ( | n | ) |
Prints successive rows of Pascal's triangle, from 0 to n.
n | a positive integer. |
References _01d_dec2bin.input, and pascal().