PascalApplet

Enter a row number (less than 34) in the text box, and hit Go! to get that row from Pascal's triangle. The middle entry(s) will be marked with [].

Source code for PascalApplet (html version)

Further Questions

1 (a)

You'll notice that if you type in a row number of 34 or above, you get incorrect results -- most notably, negative numbers. Why is this? (Hint: Think of an inherent limitation in the Java code) How do you propose to fix this?

(b) Fix the applet to support n = 35.

2

A previous implementation a student coded produced incorrect results (again, negative data) after only 16 rows. Why do you think this happened to that student? What algorithm were they using? (Hint: Think of the definition of any entry in Pascal's triangle). This shows you that two algorithms may produce the same results for some data, but there are always other things to take into consideration.

Created by Andrew Freed, arf132@psu.edu on January 30, 2002.
Modified by Andrew Freed, arf132@psu.edu on April 15, 2002.

Development of this applet was sponsored by the Penn State Fund for Excellence in Learning and Teaching (FELT), project "Java-based Teaching of Mathematics in Information Sciences and Technology", supervised by Frank Ritter and David Mudgett.