code: def is_nthpow_residue(a, n, m):
      """
      Returns True if ``x**n == a (mod m)`` has solutions.
  
      References
      ==========
  
      .. [1] P. Hackman "Elementary Number Theory" (2009), page 76
  
      """
      a = a % m
      a, n, m = as_int(a), as_int(n), as_int(m)
      if m <= 0:
          raise ValueError("m must be > 0")
      if n < 0:
          raise ValueError("n must be >= 0")
      if n == 0:
          if m == 1:
              return False
          return a == 1
      if a == 0:
          return True
      if n == 1:
          return True
      if n == 2:
          return is_quad_residue(a, m)
      return all(
          _is_nthpow_residue_bign_prime_power(a, n, p, e)
          for p, e in factorint(m).items()
      )
  
imports: from __future__ import annotations
  from sympy.external.gmpy import gcd, lcm, invert, sqrt, legendre, jacobi, kronecker, bit_scan1, remove
  from sympy.polys import Poly
  from sympy.polys.domains import ZZ
  from sympy.polys.galoistools import gf_crt1, gf_crt2, linear_congruence, gf_csolve
  from .primetest import isprime
  from .factor_ import factorint, _perfect_power
  from .modular import crt
  from sympy.utilities.decorator import deprecated
  from sympy.utilities.memoization import recurrence_memo
  from sympy.utilities.misc import as_int
  from sympy.utilities.iterables import iproduct
  from sympy.core.random import _randint, randint
  from itertools import product
label_desc: Use image node_id 13 for calling a global function with example usage: is_nthpow_residue(a, n, m) and returns: all, unknown, True, True, is_quad_residue, False