import math


def is_power(n: int, p: int) -> bool:
    """Determines if the natural number n is a perfect power with exponent p.

    Specifically, returns True iff n = m^p for some natural number m.
    """

    root_n = n**(1 / p)
    lo_power = (int(root_n))**p
    hi_power = (int(math.ceil(root_n)))**p
    return lo_power == n or hi_power == n