Solving Exponential Equations With Logarithms

Published by Matt in

Create a function that takes a number a and finds the missing exponent x so that a when raised to the power of x is equal to b.

Examples

solve_for_exp(4, 1024) ➞ 5

solve_for_exp(2, 1024) ➞ 10

solve_for_exp(9, 3486784401) ➞ 10

Notes

a is raised to the power of what in order to equal b?

Watch a quick demo on how Edabit works.