← Back to challenges

Solving Exponential Equations With Logarithms

PythonHardalgorithmsnumbersmath

Instructions

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?

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Numbers to Arrays and Vice Versa