def discrete_log(n, a, b, order=None, prime_order=None):
 if (order is None):
  order = n_order(b, n)
 if (prime_order is None):
  prime_order = isprime(order)
 if (order < 1000):
  return _discrete_log_trial_mul(n, a, b, order)
 elif prime_order:
  if (order < 1000000000000):
   return _discrete_log_shanks_steps(n, a, b, order)
  return _discrete_log_pollard_rho(n, a, b, order)
 return _discrete_log_pohlig_hellman(n, a, b, order)

def discrete_log ( n , a , b , order = None , prime_order = None ) : if ( order is None ) : order = n_order ( b , n ) if ( prime_order is None ) : prime_order = isprime ( order ) if ( order < 1000 ) : return _discrete_log_trial_mul ( n , a , b , order ) elif prime_order : if ( order < 1000000000000 ) : return _discrete_log_shanks_steps ( n , a , b , order ) return _discrete_log_pollard_rho ( n , a , b , order ) return _discrete_log_pohlig_hellman ( n , a , b , order )
compute the discrete logarithm of a to the base b modulo n .