import random


def is_prime(number, test_count):
    """
    Uses the Miller-Rabin test for primality to determine, through TEST_COUNT
    tests, whether or not NUMBER is prime.
    """
    if number == 2 or number == 3:
        return True
    if number <= 1 or number % 2 == 0:
        return False
    d = 0
    r = number - 1
    while r % 2 == 1:
        d += 1
        r //= 2
    for _1 in range(test_count):
        a = random.randrange(2, number - 1)
        x = pow(a, r, number)
        if x != 1 and x != number - 1:
            for _2 in range(d):
                x = (x ** 2) % number
                if x == 1:
                    return False
                if x == number - 1:
                    break
            if x != number - 1:
                return False
    return True