def _is_nthpow_residue_bign(a, n, m):
 if (primitive_root(m) is None):
  for (prime, power) in factorint(m).items():
   if (not _is_nthpow_residue_bign_prime_power(a, n, prime, power)):
    return False
  return True
 f = totient(m)
 k = (f // igcd(f, n))
 return (pow(a, k, m) == 1)

def _is_nthpow_residue_bign ( a , n , m ) : if ( primitive_root ( m ) is None ) : for ( prime , power ) in factorint ( m ) . items ( ) : if ( not _is_nthpow_residue_bign_prime_power ( a , n , prime , power ) ) : return False return True f = totient ( m ) k = ( f // igcd ( f , n ) ) return ( pow ( a , k , m ) == 1 )
returns true if x**n == a has solutions for n > 2 .