def checkpowerofbase(n,b):
    if(n==0):
        return False;
    while(n != 1):
        if(n%b != 0):
            return False
        n=n//b
    return True        

num=int(input())
base=int(input())
if(checkpowerofbase(num,base) == True):
    print("true")
else:
    print("false")    

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: