code: def quadratic_congruence(a, b, c, n):
      r"""
      Find the solutions to `a x^2 + b x + c \equiv 0 \pmod{n}`.
  
      Parameters
      ==========
  
      a : int
      b : int
      c : int
      n : int
          A positive integer.
  
      Returns
      =======
  
      list[int] :
          A sorted list of solutions. If no solution exists, ``[]``.
  
      Examples
      ========
  
      >>> from sympy.ntheory.residue_ntheory import quadratic_congruence
      >>> quadratic_congruence(2, 5, 3, 7) # 2x^2 + 5x + 3 = 0 (mod 7)
      [2, 6]
      >>> quadratic_congruence(8, 6, 4, 15) # No solution
      []
  
      See Also
      ========
  
      polynomial_congruence : Solve the polynomial congruence
  
      """
      a = as_int(a)
      b = as_int(b)
      c = as_int(c)
      n = as_int(n)
      if n <= 1:
          raise ValueError("n should be an integer greater than 1")
      a %= n
      b %= n
      c %= n
  
      if a == 0:
          return linear_congruence(b, -c, n)
      if n == 2:
          # assert a == 1
          roots = []
          if c == 0:
              roots.append(0)
          if (b + c) % 2:
              roots.append(1)
          return roots
      if gcd(2 * a, n) == 1:
          inv_a = invert(a, n)
          b *= inv_a
          c *= inv_a
          if b % 2:
              b += n
          b >>= 1
          return sorted(
              (i - b) % n for i in sqrt_mod_iter(b**2 - c, n)
          )
      res = set()
      for i in sqrt_mod_iter(b**2 - 4 * a * c, 4 * a * n):
          res.update(
              j % n for j in linear_congruence(2 * a, i - b, 4 * a * n)
          )
      return sorted(res)
  
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 28 for calling a global function with example usage: quadratic_congruence(a, b, c, n) and returns: sorted, linear_congruence, roots, sorted