Programming LOGARITHM

Discuss Computer Science and Programming related problems

Moderators: bristy1588, Labib

SYED ASHFAQ TASIN
Posts: 29
Joined: Thu Jun 02, 2016 6:14 pm

Programming LOGARITHM

Unread post by SYED ASHFAQ TASIN » Mon Jun 22, 2020 5:25 pm

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.
EARLY TO BED AND EARLY TO RISE,MAKES A MAN HEALTHY,WELTHY AND WISE.[\color]

User avatar
Anindya Biswas
Posts: 29
Joined: Fri Oct 02, 2020 8:51 pm
Location: Magura, Bangladesh
Contact:

Re: Programming LOGARITHM

Unread post by Anindya Biswas » Fri Oct 02, 2020 11:34 pm

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$.

Post Reply