The factorial of a number is the product of
all the numbers between 1 and the number. The factorial of 0 is 1 by
definition. Here are several examples and the general formula.
0! |
1 |
1! |
1 |
2! |
1*2 |
3! |
1*2*3 |
4! |
1*2*3*4 |
N! |
N*(N-1)! |
Although a very simple algorithm, the values
get very large very fast. In this lesson, you will run 6 applets, each of which
calculates factorials but uses a different numeric type into which to store the
result.
Follow each of the links listed below and follow
the instructions.
Look carefully at the results from each of
these applets. What conclusions can you draw about the size of the numbers that
can be manipulated using each type of number representation? Give an example of
a problem that would be appropriate for each number type.