With the help of sympy.perfect_power() method, we can find two integers b and e such that be is equal to the given number n.
n – It denotes an integer.
Returns a tuple of integers (b, e) such that be == n.
n = 64 b = 2 and e = 6. 2^6 == 64
n = 64 b = 8 and e = 2. 8^2 == 64
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.