Friday 19 October 2012

Pascal Triangle Through Python Recursive Program


Math has always been an interesting subject. Different interesting facts and theorems have made this subject even more interesting. One of them is the contribution of pascal in the form o f the what world call today "The Pascal Triangle". This triangle consists of rows of numbers with each row linked and completely dependent on the previous row.

 

In a row each number (except the 1's on the end points of the rows) is the sum of the two numbers that are above that number in the previous row.

Recursive Program: 

                                 Recursive program is a program that calls itself. This sort of program are capable of  solving problems in a lesser lines of code as compared to a simple program. Now here is a code that is written in python that calculates the pascal triangle for n number of rows and uses a recursive approach for doing this: