(a, n, m)
return pow(a, k, m) == 1
Returns True if ``x**n == a (mod m)`` has solutions.

    References
    ==========

    P. Hackman "Elementary Number Theory" (2009),  page 76
Returns True if ``x**n == a (mod m)`` has solutions.
Returns True if x ** n == a ( mod m ) has solutions .
def is_nthpow_residue(a, n, m):
    """
    Returns True if ``x**n == a (mod m)`` has solutions.

    References
    ==========

    P. Hackman "Elementary Number Theory" (2009),  page 76
    """
    if n == 1:
        return True
    if n == 2:
        return is_quad_residue(a, m)
    f = totient(m)
    k = f // igcd(f, n)
    return pow(a, k, m) == 1
def is_nthpow_residue ( a , n , m ) : if n == 1 : return True if n == 2 : return is_quad_residue ( a , m ) f = totient ( m ) k = f // igcd ( f , n ) return pow ( a , k , m ) == 1