Saturday, December 17, 2011

20-An Applet that Displays up to 4000 Numbers in the Fibonacci Sequence

An Applet that Displays up to 4000 Numbers in the Fibonacci Sequence
The following program displays a scrollable list of up to 4000 numbers in the Fibonacci Sequence. The 4000th number in the sequence displays its 836 digits in all their glory. This program allows the user to select how many numbers they wish to view in the sequence starting with 1. It is quick in that it does not use recursive function calls to calculate the results, but rather just adds the last two numbers in the sequence to generate the next number. If you select 4000 it will take a while (perhaps 5 or more minutes) to run. This program requires that your computer resolution be set to at least 1024x768. The code for the program shows how Java's BigInteger class can be used to display a huge integer. To download click here: BigFibApplet.java. To view the source code click here. To see the program run click on the picture of the applet below:
BigFibApplet


 .

0 comments:

Post a Comment