Log is not feasible


#1

Log is not feasible here as it brings precision error For ex log base 3 power 9 = 2.0000000000000004 which is not an integer


#2

what is stopping you from typecasting the log value to an int? we are not concerned much about the decimal values as the question states that P has to be an integer. so whatever value the log function results, check if base^P == A