An early application of recursion can be found in the sixteenth century in John Napier's method of finding logarithms. The method was as follows:
start with two numbers $\mathrm{n}, \mathrm{m}$ and their logarithms logn, logm if they are known;
while not done
for a geometric mean of two earlier numbers find a logarithn which is an arithmetic mean of two earlier logarithms, that is, $\operatorname{logk}=$ $(\operatorname{logn}+\operatorname{logm}) / 2$ for $\mathrm{k}=\sqrt{\mathrm{nm}}$;
proceed recursively for pairs $(\mathrm{n}, \backslash \overline{\mathrm{nm}})$ and $(\backslash \overline{\mathrm{nm}}, \mathrm{m})$;
For example, the 10-based logarithms of 100 and 1000 are numbers 2 and 3 , the geometric mean of 100 and 1000 is 316.23 , and the arithmetic mean of their logarithms, 2 and 3 , is 2.5 . Thus, the logarithm of 316,23 equals 2.5 . The process can be continued: The geometric mean of 100 and 316.23 is 177.83 whose logarithm is equal to $(2+2.5) / 2=2.25$.
a. Write a recursive function logarithm() that outputs logarithms until the difference between adjacent logarithms is smaller than a certain small number.
b. Modify this function so that a new function logarithmof () finds a logarithm of a specific number $x$ between 100 and 1000 . Stop processing if you reach a number $y$ such that $y-\mathrm{x}<\epsilon$ for some $\epsilon$.
c. Add a function which calls logar ithmof () after determining between what powers of 10 a number $x$ falls so that it does not have to be a number between 100 and 1000.