def max_divide(a: int, b: int) -> int:
    """
    Returns a after dividing it with the greatest possible power of b.
    >>> max_divide(729,3)
    1
    >>> max_divide(7543,2)
    7543
    >>> max_divide(486,3)
    2
    """
    while a % b == 0:
        a //= b
    return a