.

mail@pastecode.io avatar
unknown
plain_text
2 months ago
207 B
1
Indexable
Never
def is_power_of_b(a, b):
    if a == 0:
        return False
    while a % b == 0:
        a /= b
    return a == 1

# Example usage:
print(is_power_of_b(27, 3))  # True
print(is_power_of_b(28, 3))  # False
Leave a Comment