Logarithmic function is the inverse to the exponential function. A logarithm to the base b is the power to which b must be raised to produce a given number. For example, is equal to the power to which 2 must be raised to in order to produce 8. Clearly, 2^3 = 8 so = 3. In general, for b > 0 and b not equal to 1.
Fact about Logarithm :
- Logarithms were quickly adopted by scientists because of various useful properties that simplified long, tedious calculations.
- Logarithm to base 10 (that is b = 10) is called the common logarithm and has many applications in science and engineering.
- Natural logarithm, is a logarithm with base e. It is used in mathematics and physics, because of its simpler derivative.
- Binary logarithm is a logarithm with base 2 and is commonly used in computer science.
Laws of Logarithms :
How to find logarithm of number?
The idea is to create a function that calculates and returns . For example, if n = 64, then your function should return 6, and if n = 129, then your function should return 7.
Time complexity: O(log n)
Auxiliary space: O(log n) if the stack size is considered during recursion otherwise O(1)
More problems related to Logarithm :
- Find minimum number of Log value needed to calculate Log upto N
- Find maximum among x^(y^2) or y^(x^2) where x and y are given
- Print all substring of a number without any conversion
- Program to compare m^n and n^m
- Find larger of x^y and y^x
- Iterated Logarithm log*(n)
- Discrete logarithm (Find an integer k such that a^k is congruent modulo b)
- Check if a + b = c is valid after removing all zeroes from a, b and c
- Count operations of the given type required to reduce N to 0
- Maximum GCD from Given Product of Unknowns
- Program to find LCM of two Fibonnaci Numbers
- Minimum positive integer divisible by C and is not in range [A, B]
- Check whether XOR of all numbers in a given range is even or odd
- Count number of trailing zeros in (1^1)*(2^2)*(3^3)*(4^4)*..
- Largest sphere that can be inscribed in a right circular cylinder inscribed in a frustum
- Print numbers such that no two consecutive numbers are co-prime and every three consecutive numbers are co-prime
- Count of pairs of (i, j) such that ((n % i) % j) % n is maximized
- Minimum operations of the given type required to make a complete graph
- Midpoint ellipse drawing algorithm
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Mithun Kumar