def is_prime(n, mr_rounds=25):
    """Test whether n is probably prime

    See <https://en.wikipedia.org/wiki/Primality_test#Probabilistic_tests>

    Arguments:
        n (int): the number to be tested
        mr_rounds (int, optional): number of Miller-Rabin iterations to run;
            defaults to 25 iterations, which is what the GMP library uses

    Returns:
        bool: when this function returns False, `n` is composite (not prime);
        when it returns True, `n` is prime with overwhelming probability
    """
    # as an optimization we quickly detect small primes using the list above
    if n <= first_primes[-1]:
        return n in first_primes
    # for small dividors (relatively frequent), euclidean division is best
    for p in first_primes:
        if n % p == 0:
            return False
    # the actual generic test; give a false prime with probability 2⁻⁵⁰
    return miller_rabin(n, mr_rounds)
Test whether n is probably prime

    See <https://en.wikipedia.org/wiki/Primality_test#Probabilistic_tests>

    Arguments:
        n (int): the number to be tested
        mr_rounds (int, optional): number of Miller-Rabin iterations to run;
            defaults to 25 iterations, which is what the GMP library uses

    Returns:
        bool: when this function returns False, `n` is composite (not prime);
        when it returns True, `n` is prime with overwhelming probability