Page 1 of 1

Programming LOGARITHM

Posted: Mon Jun 22, 2020 5:25 pm
by SYED ASHFAQ TASIN
I couldn't think of an algorithm that may be able to do Log base n, I tried googling, still can not find one.
SO, Find an algorithm to calculate Logarithm.

Re: Programming LOGARITHM

Posted: Fri Oct 02, 2020 11:34 pm
by Anindya Biswas
Try this:
If $y=10^{n+\frac{a_1}{10}+\frac{a_2}{10^2}+\cdots}$ where $a_1,a_2,\cdots$ are digits, then $n.a_1a_2\cdots=\log_{10}{y}$. Now $n$ is simply the number of times you have to divide $y$ to get a number greater than or equal to $1$ and less than $10$. Here is a recursive relationship to get $1$ digit at a time:
If $10^{n+\frac{a_1}{10}+\frac{a_2}{10^2}+\cdots}=y$
Then $10^{a_1+\frac{a_2}{10}+\frac{a_3}{10^2}+\cdots}=\left(\frac{y}{10^{n}}\right)^{10}$
Now use the same method to find $a_1, a_2,\cdots$ as used to find $n$.