![]() |
||
![]() |
Department of
Mathematics and Computer Science |
![]() |
![]() |
Math 61
|
|
Data Structure Concepts:LONG INTEGER ARITHMETIC |
You have TWO OPTIONS:
OPTION I -- Write a program that will find the reciprocal (up to 100 decimal places) of an arbitrary number (of length up to 100 places). Use your program to find the values of 1/7 and 1/8. Then find the reciprocals of those reciprocals to see if you get 7 and 8 back again. Do not worry about the decimal place -- only concentrate on getting the correct digits.
When finding the "reciprocal of a reciprocal" you must store the initial reciprocal as a long integer, and then use that long integer when finding its reciprocal. You cannot have the code perform algebra, i.e., 1/(1/8.0), to simply the work!
OPTION II -- Write a program that will find the factorial of a relatively large number. Use your program to find 2000! (You should not worry about factorials larger than that.)
Note that the answer will not be able to fit on one output line (nor even on one page!)--therefore, arrange the output procedure to continue the number on additional lines. (Although you could theoretically use the Unix fold command, this does not work on a PC--your program should internally terminate a line at an appropriate length.) The correct answer is given on the LISP webpage "LISP Example," at this link.
GENERAL NOTES: