code: def _discrete_log_pohlig_hellman(n, a, b, order=None):
      """
      Pohlig-Hellman algorithm for computing the discrete logarithm of ``a`` to
      the base ``b`` modulo ``n``.
  
      In order to compute the discrete logarithm, the algorithm takes advantage
      of the factorization of the group order. It is more efficient when the
      group order factors into many small primes.
  
      Examples
      ========
  
      >>> from sympy.ntheory.residue_ntheory import _discrete_log_pohlig_hellman
      >>> _discrete_log_pohlig_hellman(251, 210, 71)
      197
  
      See Also
      ========
  
      discrete_log
  
      References
      ==========
  
      .. [1] "Handbook of applied cryptography", Menezes, A. J., Van, O. P. C., &
          Vanstone, S. A. (1997).
      """
      from .modular import crt
  
      a %= n
      b %= n
  
      if order is None:
          order = n_order(b, n)
  
      f = factorint(order)
      l = [0] * len(f)
  
      for i, (pi, ri) in enumerate(f.items()):
          for j in range(ri):
              aj = pow(a * pow(b, -l[i], n), order // pi ** (j + 1), n)
              bj = pow(b, order // pi, n)
              cj = discrete_log(n, aj, bj, pi, True)
              l[i] += cj * pi**j
  
      d, _ = crt([pi**ri for pi, ri in f.items()], l)
      return d
  
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 26 for calling a global function with example usage: _discrete_log_pohlig_hellman(n, a, b, order) and returns: d