def mr(n, bases):
 from sympy.ntheory.factor_ import trailing
 from sympy.polys.domains import ZZ
 n = as_int(n)
 if (n < 2):
  return False
 s = trailing((n - 1))
 t = (n >> s)
 for base in bases:
  if (base >= n):
   base %= n
  if (base >= 2):
   base = ZZ(base)
   if (not _test(n, base, s, t)):
    return False
 return True

def mr ( n , bases ) : from sympy . ntheory . factor_ import trailing from sympy . polys . domains import ZZ n = as_int ( n ) if ( n < 2 ) : return False s = trailing ( ( n - 1 ) ) t = ( n >> s ) for base in bases : if ( base >= n ) : base %= n if ( base >= 2 ) : base = ZZ ( base ) if ( not _test ( n , base , s , t ) ) : return False return True
perform a miller-rabin strong pseudoprime test on n using a given list of bases/witnesses .