def carmichael_of_ppower(pp):
    """Carmichael function of the given power of the given prime.
  """
    p, a = pp
    if p == 2 and a > 2:
        return 2 ** (a - 2)
    else:
        return (p - 1) * p ** (a - 1)
